2020#
2121# Change Logs:
2222# Date Author Notes
23- # 2018-5-28 SummerGift Add copyright information
23+ # 2018-05-28 SummerGift Add copyright information
24+ # 2019-01-07 SummerGift The prompt supports utf-8 encoding
2425#
2526
2627import os
@@ -156,27 +157,26 @@ def cmd(args):
156157 dirname = os .path .split (os .path .split (currentdir )[0 ])[0 ]
157158 get_rtt_name = os .path .basename (dirname )
158159 os_version = platform .platform (True )[10 :13 ]
159- # print os.path.split(currentdir)[1]
160160 kconfig_win7_path = os .path .join (
161161 env_root , 'tools' , 'bin' , 'kconfig-mconf_win7.exe' )
162162
163163 if not os .getenv ("RTT_ROOT" ):
164164 if get_rtt_name != 'rt-thread' :
165- print ("menuconfig command should be used in a bsp root path with a Kconfig file, you should check if there is a Kconfig file in your bsp root first." )
166- print (
167- 'And then you can check Kconfig file and modify the default option below to your rtthread root path.\n ' )
165+ print ("\n <menuconfig> 命令应当在一个 BSP 的根目录下被执行,请确保当前目录为 BSP 根目录,并且根目录中有 Kconfig 文件。" )
166+ print ("接下来你可以按照如下方式修改 Kconfig 文件:\n " )
167+
168+ print ("<menuconfig> command should be used in a bsp root path with a Kconfig file." )
169+ print ("You should check if there is a Kconfig file in your bsp root first." )
170+ print ('And then you can check Kconfig file and modify the default option below to your rtthread root path.\n ' )
168171
169172 print ('config $RTT_DIR' )
170173 print ('string' )
171174 print ('option env="RTT_ROOT"' )
172175 print ('default "../.."\n ' )
173- print ('example : default "F:/git_repositories/rt-thread" \n ' )
176+ print ('例如修改 default 这一项为 rt-thread 所在路径 : default "F:/git_repositories/rt-thread"' )
174177
175- print (
176- "using command 'set RTT_ROOT=your_rtthread_root_path' to set RTT_ROOT is ok too.\n " )
177- print ("you can ignore debug messages below." )
178- # if not args.menuconfig_easy:
179- # return
178+ if not args .menuconfig_easy :
179+ return
180180
181181 fn = '.config'
182182
@@ -185,6 +185,9 @@ def cmd(args):
185185 else :
186186 mtime = - 1
187187
188+ if platform .system () == "Windows" :
189+ os .system ('chcp 437 > nul' )
190+
188191 if args .menuconfig_fn :
189192 print 'use' , args .menuconfig_fn
190193 import shutil
@@ -215,6 +218,10 @@ def cmd(args):
215218 os .system ('kconfig-mconf Kconfig' )
216219
217220 os .chdir (beforepath )
221+
222+ if platform .system () == "Windows" :
223+ os .system ('chcp 65001 > nul' )
224+
218225 return
219226 else :
220227 if float (os_version ) >= 6.2 :
@@ -233,14 +240,16 @@ def cmd(args):
233240 if mtime != mtime2 :
234241 mk_rtconfig (fn )
235242
243+ if platform .system () == "Windows" :
244+ os .system ('chcp 65001 > nul' )
245+
236246 if platform .system () == "Windows" :
237247 env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
238248 fn = os .path .join (env_kconfig_path , '.config' )
239249
240250 if not os .path .isfile (fn ):
241251 return
242252
243-
244253 if find_macro_in_config (fn , 'SYS_AUTO_UPDATE_PKGS' ):
245254 os .system ('pkgs --update' )
246255 print "==============================>The packages have been updated completely."
0 commit comments