Ai
1 Star 1 Fork 0

FlayFly/rt-thread

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
genconf.py 854 Bytes
一键复制 编辑 原始数据 按行查看 历史
bernard 提交于 2018-11-10 18:29 +08:00 . [Tools] Change building script for Py3
import os
def genconfig() :
from SCons.Script import SCons
PreProcessor = SCons.cpp.PreProcessor()
try:
f = open('rtconfig.h', 'r')
contents = f.read()
f.close()
except :
print("Open rtconfig.h file failed.")
PreProcessor.process_contents(contents)
options = PreProcessor.cpp_namespace
try:
f = open('.config', 'w')
for (opt, value) in options.items():
if type(value) == type(1):
f.write("CONFIG_%s=%d\n" % (opt, value))
if type(value) == type('') and value == '':
f.write("CONFIG_%s=y\n" % opt)
elif type(value) == type('str'):
f.write("CONFIG_%s=%s\n" % (opt, value))
print("Generate .config done!")
f.close()
except:
print("Generate .config file failed.")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flayfly/rt-thread.git
git@gitee.com:flayfly/rt-thread.git
flayfly
rt-thread
rt-thread
master

搜索帮助