source: CCCC/manage/step1.py @ 293

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CCCC/manage/step1.py
Revision 293, 978 bytes checked in by mjuckes, 5 years ago (diff)

tag management code added

Line 
1
2import sys, os, glob, string
3if os.path.isfile( 'step2.sh' ):
4  os.unlink( 'step2.sh' )
5
6ii = string.join( open( 'versionConfig.tmpl' ).readlines() )
7tags = glob.glob( '../tags/*' )
8f1 = lambda x: map( int, string.split(x, '.' ) )
9tn = map( lambda x: tuple( f1(string.split(x,'/')[-1]) ),  tags )
10tn.sort()
11thistag, thiscomment = sys.argv[1:]
12thistn = tuple( f1( thistag ) )
13assert thistn > tn[-1], 'Requested tag not greater than last tag: %s' % str(tn[-1])
14
15oo = open( '../trunk/ceda_cc/versionConfig.py', 'w' )
16for l in string.split( ii % (thistag, thiscomment), '\n' ):
17  oo.write( '%s\n' % string.strip(l) )
18oo.close()
19
20bashtmpl = """
21tag=%(thistag)s
22comment='"%(thiscomment)s"'
23
24echo $tag, $comment
25cd ../trunk
26svn ci -m "Updated setup for tag %(thistag)s"
27svn copy http://proj.badc.rl.ac.uk/svn/exarch/CCCC/trunk http://proj.badc.rl.ac.uk/svn/exarch/CCCC/tags/%(thistag)s -m "%(thiscomment)s"
28"""
29
30oo = open( 'step2.sh', 'w' )
31oo.write( bashtmpl % locals() )
32oo.close()
Note: See TracBrowser for help on using the repository browser.