代码拉取完成,页面将自动刷新
同步操作将从 MacRsh/mr-library 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python
"""
@copyright (c) 2023-2024, MR Development Team
@license SPDX-License-Identifier: Apache-2.0
@date 2023-12-17 MacRsh First version
"""
import re
try:
from tool import install_package
except ImportError:
exit(1)
try:
from kconfiglib import Kconfig
except ImportError:
install_package('kconfiglib')
from kconfiglib import Kconfig
try:
import curses
except ImportError:
install_package('windows-curses')
import curses
try:
from tool import log_print
except ImportError:
exit(1)
def generate_config_file(kconfig_file, config_in, config_out, header_out):
kconf = Kconfig(kconfig_file, warn=False, warn_to_stderr=False)
# Load config
kconf.load_config(config_in)
kconf.write_config(config_out)
kconf.write_autoconf(header_out)
with open(header_out, 'r+') as header_file:
content = header_file.read()
header_file.truncate(0)
header_file.seek(0)
# Remove CONFIG_ and MR_USING_XXX following number
content = content.replace("#define CONFIG_", "#define ")
content = re.sub(r'#define MR_USING_(\w+) (\d+)', r'#define MR_USING_\1', content)
# Add the micro
header_file.write("#ifndef _MR_CONFIG_H_\n")
header_file.write("#define _MR_CONFIG_H_\n\n")
header_file.write("#ifdef __cplusplus\n")
header_file.write("extern \"C\" {\n")
header_file.write("#endif /* __cplusplus */\n\n")
# Write back the original data
header_file.write(content)
# Add the micro
header_file.write("\n#ifdef __cplusplus\n")
header_file.write("}\n")
header_file.write("#endif /* __cplusplus */\n\n")
header_file.write("#endif /* _MR_CONFIG_H_ */\n")
header_file.close()
log_print('success', "mr-library config file make success")
def main():
kconfig_file = 'Kconfig'
config_in = '.config'
config_out = '.config'
header_out = 'include/mr_config.h'
generate_config_file(kconfig_file, config_in, config_out, header_out)
if __name__ == "__main__":
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。