Changes in tools/config.py [fe12f9f4:4e9aaf5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/config.py
rfe12f9f4 r4e9aaf5 28 28 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 29 # 30 30 31 """ 31 32 HelenOS configuration system 32 33 """ 34 33 35 import sys 34 36 import os … … 41 43 MAKEFILE = 'Makefile.config' 42 44 MACROS = 'config.h' 43 DEFS = 'config.defs'44 45 PRECONF = 'defaults' 45 46 … … 223 224 return True 224 225 225 def create_output(mkname, mcname, d fname, defaults, ask_names):226 def create_output(mkname, mcname, defaults, ask_names): 226 227 "Create output configuration" 227 228 … … 229 230 230 231 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") 233 239 234 240 if (len(version) == 3): … … 242 248 outmk = file(mkname, 'w') 243 249 outmc = file(mcname, 'w') 244 outdf = file(dfname, 'w')245 250 246 251 outmk.write('#########################################\n') … … 252 257 outmc.write(' ***************************************/\n\n') 253 258 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 =' 258 260 259 261 for varname, vartype, name, choices, cond in ask_names: … … 273 275 if (default == "y"): 274 276 outmc.write('/* %s */\n#define %s\n\n' % (name, varname)) 275 outdf.write(' -D%s' % varname)277 defs += ' -D%s' % varname 276 278 else: 277 279 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) 279 281 280 282 if (revision is not None): 281 283 outmk.write('REVISION = %s\n' % revision) 282 284 outmc.write('#define REVISION %s\n' % revision) 283 outdf.write(' "-DREVISION=%s"' % revision)285 defs += ' "-DREVISION=%s"' % revision 284 286 285 287 outmk.write('TIMESTAMP = %s\n' % timestamp) 286 288 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) 288 292 289 293 outmk.close() 290 294 outmc.close() 291 outdf.close()292 295 293 296 def sorted_dir(root): … … 348 351 if ((len(sys.argv) >= 3) and (sys.argv[2] == 'default')): 349 352 if (check_choices(defaults, ask_names)): 350 create_output(MAKEFILE, MACROS, DEFS,defaults, ask_names)353 create_output(MAKEFILE, MACROS, defaults, ask_names) 351 354 return 0 352 355 … … 466 469 xtui.screen_done(screen) 467 470 468 create_output(MAKEFILE, MACROS, DEFS,defaults, ask_names)471 create_output(MAKEFILE, MACROS, defaults, ask_names) 469 472 return 0 470 473
Note:
See TracChangeset
for help on using the changeset viewer.