1 Star 0 Fork 2.1K

guowentao/rt-thread

forked from RT-Thread/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 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/guowentao2022/rt-thread.git
git@gitee.com:guowentao2022/rt-thread.git
guowentao2022
rt-thread
rt-thread
v4.0.3

搜索帮助

371d5123 14472233 46e8bd33 14472233