Changeset 360


Ignore:
Timestamp:
27/07/15 11:50:40 (5 years ago)
Author:
mjuckes
Message:

added makefile for ease of updates

Location:
CMIP6dreqbuild/trunk/src/framework
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/src/framework/ptxt.py

    r352 r360  
    22USAGE 
    33..... 
    4 ptxt.py [samp|defn] 
     4ptxt.py [-f srcFile] [samp|defn] 
    55''' 
    66import string, re, collections, sys 
    77 
    8 if len(sys.argv) > 1: 
    9   mode = sys.argv[1] 
     8if len(sys.argv) == 1: 
     9  print __doc__ 
     10  exit() 
     11 
     12args = sys.argv[1:] 
     13if args[0] == '-f': 
     14  srcFn = args[1] 
     15  args = args[2:] 
     16else: 
     17  srcFn = 'parVocabDefn.txt' 
     18  srcFn = 'dreqDefn.txt' 
     19   
     20mode = args[0] 
    1021 
    1122assert mode in ["defn", "samp"] 
     
    156167class main(object): 
    157168 
    158   def __init__(self): 
     169  def __init__(self,fn): 
    159170    ii = [] 
    160     fn = 'parVocabDefn.txt' 
    161     fn = 'dreqDefn.txt' 
    162171    for l in open('../../docs/%s' % fn).readlines(): 
    163172      if l[0] != '#': 
     
    165174    kk= 0 
    166175    this = None 
    167     fns = {'defn':'parVocabDefn', 'samp':'parVocabSample' } 
     176    fstem = string.split( fn, '.' )[0] 
     177    fns = {'defn':'%sDefn' % fstem, 'samp':'%sSample' % fstem } 
    168178    fn = fns[mode] 
    169179    oo = open( 'out/%s.xml' % fn, 'w' ) 
     
    190200     
    191201 
    192 m = main() 
     202m = main(srcFn) 
Note: See TracChangeset for help on using the changeset viewer.