Skip to content

Commit 186d7cf

Browse files
authored
Merge pull request #3163 from SummerGGift/update_rt_config_gen_func
[tools/menuconfig.py] update rt_config.h generation func
2 parents 43a46ee + 9eca803 commit 186d7cf

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tools/menuconfig.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030

3131
# make rtconfig.h from .config
3232

33+
def is_pkg_special_config(config_str):
34+
''' judge if it's CONFIG_PKG_XX_PATH or CONFIG_PKG_XX_VER'''
35+
36+
if type(config_str) == type('a'):
37+
if config_str.startswith("PKG_") and (config_str.endswith('_PATH') or config_str.endswith('_VER')):
38+
return True
39+
return False
40+
41+
3342
def mk_rtconfig(filename):
3443
try:
3544
config = open(filename, 'r')
@@ -46,7 +55,8 @@ def mk_rtconfig(filename):
4655
for line in config:
4756
line = line.lstrip(' ').replace('\n', '').replace('\r', '')
4857

49-
if len(line) == 0: continue
58+
if len(line) == 0:
59+
continue
5060

5161
if line[0] == '#':
5262
if len(line) == 1:
@@ -57,11 +67,12 @@ def mk_rtconfig(filename):
5767
empty_line = 1
5868
continue
5969

60-
comment_line = line[1:]
61-
if line.startswith('# CONFIG_'): line = ' ' + line[9:]
62-
else: line = line[1:]
70+
if line.startswith('# CONFIG_'):
71+
line = ' ' + line[9:]
72+
else:
73+
line = line[1:]
74+
rtconfig.write('/*%s */\n' % line)
6375

64-
rtconfig.write('/*%s */\n' % line)
6576
empty_line = 0
6677
else:
6778
empty_line = 0
@@ -71,7 +82,7 @@ def mk_rtconfig(filename):
7182
setting[0] = setting[0][7:]
7283

7384
# remove CONFIG_PKG_XX_PATH or CONFIG_PKG_XX_VER
74-
if type(setting[0]) == type('a') and (setting[0].endswith('_PATH') or setting[0].endswith('_VER')):
85+
if is_pkg_special_config(setting[0]):
7586
continue
7687

7788
if setting[1] == 'y':

0 commit comments

Comments
 (0)