MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / genconfig

Function genconfig

tools/env_utility.py:459–488  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457
458
459def genconfig():
460 from SCons.Script import SCons
461
462 PreProcessor = SCons.cpp.PreProcessor()
463
464 try:
465 f = open('rtconfig.h', 'r')
466 contents = f.read()
467 f.close()
468 except:
469 print("Open rtconfig.h file failed.")
470
471 PreProcessor.process_contents(contents)
472 options = PreProcessor.cpp_namespace
473
474 try:
475 f = open('.config', 'w')
476 for opt, value in options.items():
477 if type(value) == type(1):
478 f.write("CONFIG_%s=%d\n" % (opt, value))
479
480 if type(value) == type('') and value == '':
481 f.write("CONFIG_%s=y\n" % opt)
482 elif type(value) == type('str'):
483 f.write("CONFIG_%s=%s\n" % (opt, value))
484
485 print("Generate .config done!")
486 f.close()
487 except:
488 print("Generate .config file failed.")

Callers 1

PrepareBuildingFunction · 0.90

Calls 3

openFunction · 0.50
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected