Changes in tools/config.py [fe12f9f4:4e9aaf5] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/config.py

    rfe12f9f4 r4e9aaf5  
    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.