Changeset 76ca3f7 in mainline for tools/config.py


Ignore:
Timestamp:
2010-03-23T20:49:54Z (15 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e417b96
Parents:
b48ebd19 (diff), 63f8966 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mailnline changes, revision 329

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/config.py

    rb48ebd19 r76ca3f7  
    2828# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929#
     30
    3031"""
    3132HelenOS configuration system
    3233"""
     34
    3335import sys
    3436import os
     
    4143MAKEFILE = 'Makefile.config'
    4244MACROS = 'config.h'
    43 DEFS = 'config.defs'
    4445PRECONF = 'defaults'
    4546
     
    223224        return True
    224225
    225 def create_output(mkname, mcname, dfname, defaults, ask_names):
     226def create_output(mkname, mcname, defaults, ask_names):
    226227        "Create output configuration"
    227228       
     
    229230       
    230231        sys.stderr.write("Fetching current revision identifier ... ")
    231         version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
    232         sys.stderr.write("OK\n")
     232       
     233        try:
     234                version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
     235                sys.stderr.write("ok\n")
     236        except:
     237                version = [1, "unknown", "unknown"]
     238                sys.stderr.write("failed\n")
    233239       
    234240        if (len(version) == 3):
     
    242248        outmk = file(mkname, 'w')
    243249        outmc = file(mcname, 'w')
    244         outdf = file(dfname, 'w')
    245250       
    246251        outmk.write('#########################################\n')
     
    252257        outmc.write(' ***************************************/\n\n')
    253258       
    254         outdf.write('#########################################\n')
    255         outdf.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
    256         outdf.write('#########################################\n\n')
    257         outdf.write('CONFIG_DEFS =')
     259        defs = 'CONFIG_DEFS ='
    258260       
    259261        for varname, vartype, name, choices, cond in ask_names:
     
    273275                        if (default == "y"):
    274276                                outmc.write('/* %s */\n#define %s\n\n' % (name, varname))
    275                                 outdf.write(' -D%s' % varname)
     277                                defs += ' -D%s' % varname
    276278                else:
    277279                        outmc.write('/* %s */\n#define %s %s\n#define %s_%s\n\n' % (name, varname, default, varname, default))
    278                         outdf.write(' -D%s=%s -D%s_%s' % (varname, default, varname, default))
     280                        defs += ' -D%s=%s -D%s_%s' % (varname, default, varname, default)
    279281       
    280282        if (revision is not None):
    281283                outmk.write('REVISION = %s\n' % revision)
    282284                outmc.write('#define REVISION %s\n' % revision)
    283                 outdf.write(' "-DREVISION=%s"' % revision)
     285                defs += ' "-DREVISION=%s"' % revision
    284286       
    285287        outmk.write('TIMESTAMP = %s\n' % timestamp)
    286288        outmc.write('#define TIMESTAMP %s\n' % timestamp)
    287         outdf.write(' "-DTIMESTAMP=%s"\n' % timestamp)
     289        defs += ' "-DTIMESTAMP=%s"\n' % timestamp
     290       
     291        outmk.write(defs)
    288292       
    289293        outmk.close()
    290294        outmc.close()
    291         outdf.close()
    292295
    293296def sorted_dir(root):
     
    348351        if ((len(sys.argv) >= 3) and (sys.argv[2] == 'default')):
    349352                if (check_choices(defaults, ask_names)):
    350                         create_output(MAKEFILE, MACROS, DEFS, defaults, ask_names)
     353                        create_output(MAKEFILE, MACROS, defaults, ask_names)
    351354                        return 0
    352355       
     
    466469                xtui.screen_done(screen)
    467470       
    468         create_output(MAKEFILE, MACROS, DEFS, defaults, ask_names)
     471        create_output(MAKEFILE, MACROS, defaults, ask_names)
    469472        return 0
    470473
Note: See TracChangeset for help on using the changeset viewer.