Changeset 4135 for devel


Ignore:
Timestamp:
May 21, 2011 12:12:39 PM (8 years ago)
Author:
wehart
Message:

Update to reconfig script.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/reconfig

    r3412 r4135  
    99import sys
    1010import commands
     11import urllib2
     12import StringIO
    1113
    12 def create(name,type):
     14def parse(file, type, externals=None, config=None):
     15    if externals is None:
     16        externals = []
     17
     18    if config is None:
     19        config = ConfigParser.ConfigParser()
     20    if os.path.exists(file):
     21        config.read(file)
     22    else:
     23        output = urllib2.urlopen(file, timeout=30).read()
     24        fp = StringIO.StringIO(output)
     25        config.readfp(fp, file)
     26        fp.close()
     27
     28    for section in config.sections():
     29        for option in config.options(section):
     30            if section == 'externals':
     31                cfg = ConfigParser.ConfigParser()
     32                parse(config.get(section, option), type, externals, cfg)
     33            elif option in 'release':
     34                externals.append(section+' '+config.get(section,option))
     35            elif option == 'root':
     36                externals.append(section+' '+config.get(section,option)+'/'+type)
     37    return externals
     38
     39def create(name, type, externals):
    1340    #
    1441    if not os.path.exists(name+'_'+type):
    1542        print commands.getoutput('svn mkdir '+name+'_'+type)
    1643    #
    17     externals = []
    18     for section in config.sections():
    19         for option in config.options(section):
    20             if option in 'release':
    21                 externals.append(section+' '+config.get(section,option))
    22             elif option == 'root':
    23                 externals.append(section+' '+config.get(section,option)+'/'+type)
    2444    if len(externals) > 0:
    2545        os.chdir(name+'_'+type)
     
    3454for file in glob.glob("../vpy/*.ini"):
    3555    print "Processing "+file
    36     config = ConfigParser.ConfigParser()
    37     config.read(file)
     56    externals = parse(file, 'trunk')
    3857    #
    3958    name = os.path.splitext(os.path.basename(file))[0]
    40     create(name,'trunk')
     59    #print name
     60    create(name, 'trunk', externals)
    4161
    4262       
Note: See TracChangeset for help on using the changeset viewer.