summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguozhanxin <[email protected]>2021-05-14 17:07:58 +0800
committerguozhanxin <[email protected]>2021-05-14 17:11:20 +0800
commit3369a2c1c89a79b4e773ace71c81b5f42b35e4d0 (patch)
treee122a8ba9abec40385d357b51c71f476a8bb202f
parent5767c2e0f4792adfe7d8031591bfdf95ba004bdb (diff)
[fix] Fix the problem of an error when opening menuconfig after the project is dist.
-rw-r--r--tools/mkdist.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/mkdist.py b/tools/mkdist.py
index 7765873baa..a29db7b080 100644
--- a/tools/mkdist.py
+++ b/tools/mkdist.py
@@ -105,6 +105,18 @@ def bsp_update_sconstruct(dist_dir):
f.write('if not os.getenv("RTT_ROOT"): \n RTT_ROOT="rt-thread"\n\n')
f.write(line)
+def bsp_update_kconfig_testcases(dist_dir):
+ # delete testcases in rt-thread/Kconfig
+ if not os.path.isfile(os.path.join(dist_dir, 'rt-thread/Kconfig')):
+ return
+
+ with open(os.path.join(dist_dir, 'rt-thread/Kconfig'), 'r') as f:
+ data = f.readlines()
+ with open(os.path.join(dist_dir, 'rt-thread/Kconfig'), 'w') as f:
+ for line in data:
+ if line.find('examples/utest/testcases/Kconfig') == -1:
+ f.write(line)
+
def bsp_update_kconfig(dist_dir):
# change RTT_ROOT in Kconfig
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
@@ -307,11 +319,14 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'Kconfig'), os.path.join(target_path, 'libcpu', 'Kconfig'))
do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'SConscript'), os.path.join(target_path, 'libcpu', 'SConscript'))
+ print('Update configuration files...')
# change RTT_ROOT in SConstruct
bsp_update_sconstruct(dist_dir)
# change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir)
+ # delete testcases in Kconfig
+ bsp_update_kconfig_testcases(dist_dir)
# update all project files
bs_update_ide_project(dist_dir, target_path)
@@ -374,12 +389,14 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env, rttide = None):
do_copy_file(os.path.join(RTT_ROOT, 'README.md'), os.path.join(target_path, 'README.md'))
do_copy_file(os.path.join(RTT_ROOT, 'README_zh.md'), os.path.join(target_path, 'README_zh.md'))
+ print('Update configuration files...')
# change RTT_ROOT in SConstruct
bsp_update_sconstruct(dist_dir)
# change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir)
-
+ # delete testcases in Kconfig
+ bsp_update_kconfig_testcases(dist_dir)
# update all project files
if rttide == None:
bs_update_ide_project(dist_dir, target_path)