Skip to content

Commit 7de8c3e

Browse files
committed
【修改】:完善中文提示信息
1 parent a397567 commit 7de8c3e

File tree

2 files changed

+22
-29
lines changed

2 files changed

+22
-29
lines changed

cmds/cmd_menuconfig.py

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -153,31 +153,26 @@ def find_macro_in_config(filename, macro_name):
153153

154154
def cmd(args):
155155

156-
from cmd_package import determine_support_chinese
157156
env_root = Import('env_root')
158-
currentdir = os.getcwd()
159-
dirname = os.path.split(os.path.split(currentdir)[0])[0]
160-
get_rtt_name = os.path.basename(dirname)
161157
os_version = platform.platform(True)[10:13]
162158
kconfig_win7_path = os.path.join(
163159
env_root, 'tools', 'bin', 'kconfig-mconf_win7.exe')
164160

165-
if not os.getenv("RTT_ROOT"):
166-
if get_rtt_name != 'rt-thread':
167-
if determine_support_chinese(env_root):
168-
print("\n<menuconfig> 命令应当在某一特定 BSP 目录下执行,例如:\"rt-thread/bsp/stm32/stm32f091-st-nucleo\"")
169-
print("请确保当前目录为 BSP 根目录,并且该目录中有 Kconfig 文件。\n")
161+
if not os.path.exists('Kconfig'):
162+
if platform.system() == "Windows":
163+
os.system('chcp 65001 > nul')
164+
165+
print("\n<menuconfig> 命令应当在某一特定 BSP 目录下执行,例如:\"rt-thread/bsp/stm32/stm32f091-st-nucleo\"")
166+
print("请确保当前目录为 BSP 根目录,并且该目录中有 Kconfig 文件。\n")
170167

171-
print ("\n<menuconfig> command should be used in a bsp root path with a Kconfig file.")
172-
print ("Example: \"rt-thread/bsp/stm32/stm32f091-st-nucleo\"")
173-
print ("You should check if there is a Kconfig file in your bsp root first.")
168+
print ("<menuconfig> command should be used in a bsp root path with a Kconfig file.")
169+
print ("Example: \"rt-thread/bsp/stm32/stm32f091-st-nucleo\"")
170+
print ("You should check if there is a Kconfig file in your bsp root first.")
174171

175-
if determine_support_chinese(env_root):
176-
print ('例如修改 default 这一项为 rt-thread 所在路径: default "F:/git_repositories/rt-thread"')
177-
print ('\n下面的警告信息提示与找不到正确的 Kconfig 文件有关:')
172+
if platform.system() == "Windows":
173+
os.system('chcp 437 > nul')
178174

179-
# if not args.menuconfig_easy:
180-
# return
175+
return False
181176

182177
fn = '.config'
183178

@@ -219,10 +214,7 @@ def cmd(args):
219214
os.system('kconfig-mconf Kconfig')
220215

221216
os.chdir(beforepath)
222-
223-
if determine_support_chinese(env_root):
224-
if platform.system() == "Windows":
225-
os.system('chcp 65001 > nul')
217+
226218
return
227219

228220
else:
@@ -242,10 +234,6 @@ def cmd(args):
242234
if mtime != mtime2:
243235
mk_rtconfig(fn)
244236

245-
if determine_support_chinese(env_root):
246-
if platform.system() == "Windows":
247-
os.system('chcp 65001 > nul')
248-
249237
if platform.system() == "Windows":
250238
env_kconfig_path = os.path.join(env_root, 'tools\scripts\cmds')
251239
fn = os.path.join(env_kconfig_path, '.config')

cmds/cmd_package.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,20 @@ def pre_package_update():
510510

511511
bsp_root = Import('bsp_root')
512512
env_root = Import('env_root')
513-
from cmd_package import determine_support_chinese
514513

515514
if not os.path.exists('.config'):
516-
if determine_support_chinese(env_root):
517-
print ("\n当前路径下没有发现 .config 文件,请确保当前目录为 BSP 根目录。")
518-
print ("如果确定当前目录为 BSP 根目录,请先使用 <menuconfig> 命令来生成 .config 文件。\n")
515+
if platform.system() == "Windows":
516+
os.system('chcp 65001 > nul')
517+
518+
print ("\n当前路径下没有发现 .config 文件,请确保当前目录为 BSP 根目录。")
519+
print ("如果确定当前目录为 BSP 根目录,请先使用 <menuconfig> 命令来生成 .config 文件。\n")
519520

520521
print ('No system configuration file : .config.')
521522
print ('You should use < menuconfig > command to config bsp first.')
523+
524+
if platform.system() == "Windows":
525+
os.system('chcp 437 > nul')
526+
522527
return False
523528

524529
bsp_packages_path = os.path.join(bsp_root, 'packages')

0 commit comments

Comments
 (0)