Changeset 359 for CMIP6dreq


Ignore:
Timestamp:
27/07/15 09:14:32 (5 years ago)
Author:
mjuckes
Message:

adapted 'step1.py' to handle alpha and beta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreq/manage/step1.py

    r357 r359  
    1818tags = glob.glob( '../tags/*' ) 
    1919f1 = lambda x: map( int, string.split(x, '.' ) ) 
    20 tn = map( lambda x: tuple( f1(string.split(x,'/')[-1]) ),  tags ) 
    21 tn.sort() 
     20def f1( vs ): 
     21  bits = string.split(vs, '.' ) 
     22  estr = 'Version string should be "nn.nn" or "nn.[alpha|beta].nn": %s' % vs 
     23  assert len(bits) in [2,3], estr 
     24  if len( bits ) == 3: 
     25    assert bits[1] in ['alpha','beta'], estr 
     26  assert len(bits[0]) == 2 and len(bits[-1]) == 2, estr 
     27  bits[0] = int( bits[0] ) 
     28  bits[-1] = int( bits[-1] ) 
     29  return bits 
     30 
     31def tcmp(t1,t2): 
     32  if len(t1) != len(t2): 
     33    if t1[0] == t2[0]: 
     34      return cmp( len(t1), len(t2) ) 
     35    else: 
     36      return cmp( t1[0], t2[0] ) 
     37  elif len(t1) == 2: 
     38    if t1[0] == t2[0]: 
     39      return cmp( t1[1], t2[1] ) 
     40    else: 
     41      return cmp( t1[0], t2[0] ) 
     42  elif len(t1) == 3: 
     43    if t1[0] == t2[0]: 
     44      if t1[1] == t2[1]: 
     45        return cmp( t1[2], t2[2] ) 
     46      else: 
     47        return cmp( t1[1], t2[1] ) 
     48    else: 
     49      return cmp( t1[0], t2[0] ) 
     50     
    2251thistag, thiscomment = sys.argv[1:] 
    2352thistn = tuple( f1( thistag ) ) 
    24 assert thistn > tn[-1], 'Requested tag not greater than last tag: %s' % str(tn[-1]) 
     53if len(tags) > 0: 
     54  tn = map( lambda x: tuple( f1(string.split(x,'/')[-1]) ),  tags ) 
     55  tn.sort(tcmp) 
     56  assert thistn > tn[-1], 'Requested tag not greater than last tag: %s' % str(tn[-1]) 
    2557 
    2658oo = open( '../trunk/src/versionConfig.py', 'w' ) 
     
    3668cd ../trunk 
    3769svn ci -m "Updated setup for tag %(thistag)s" 
    38 svn copy %(svnBaseUrl)/trunk %(svnBaseUrl)/tags/%(thistag)s -m "%(thiscomment)s" 
     70svn copy %(svnBaseUrl)s/trunk %(svnBaseUrl)s/tags/%(thistag)s -m "%(thiscomment)s" 
    3971""" 
    4072 
Note: See TracChangeset for help on using the changeset viewer.