source: CMIP6dreq/manage/step1.py @ 357

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreq/manage/step1.py@357
Revision 357, 1.2 KB checked in by mjuckes, 5 years ago (diff)

added 'manage' directory

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