Skip to content

Commit 4972c5c

Browse files
authored
Merge pull request #48 from SummerGGift/20180807
【完善】:env 在更新软件包时的操作安全性
2 parents 54c621d + 368889b commit 4972c5c

File tree

2 files changed

+345
-185
lines changed

2 files changed

+345
-185
lines changed

cmds/cmd_menuconfig.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def mk_rtconfig(filename):
105105
rtconfig.close()
106106

107107

108-
def find_macro_in_condfig(filename, macro_name):
108+
def find_macro_in_config(filename, macro_name):
109109
try:
110110
config = file(filename)
111111
except:
@@ -134,7 +134,7 @@ def find_macro_in_condfig(filename, macro_name):
134134
else:
135135
line = line[1:]
136136

137-
#print line
137+
# print line
138138

139139
empty_line = 0
140140
else:
@@ -156,7 +156,7 @@ def cmd(args):
156156
dirname = os.path.split(os.path.split(currentdir)[0])[0]
157157
get_rtt_name = os.path.basename(dirname)
158158
os_version = platform.platform(True)[10:13]
159-
#print os.path.split(currentdir)[1]
159+
# print os.path.split(currentdir)[1]
160160
kconfig_win7_path = os.path.join(
161161
env_root, 'tools', 'bin', 'kconfig-mconf_win7.exe')
162162

@@ -175,7 +175,7 @@ def cmd(args):
175175
print (
176176
"using command 'set RTT_ROOT=your_rtthread_root_path' to set RTT_ROOT is ok too.\n")
177177
print ("you can ignore debug messages below.")
178-
#if not args.menuconfig_easy:
178+
# if not args.menuconfig_easy:
179179
# return
180180

181181
fn = '.config'
@@ -239,24 +239,19 @@ def cmd(args):
239239
if not os.path.isfile(fn):
240240
return
241241

242-
print("\nTry the command <menuconfig -s/--setting> ")
243-
print(
244-
"\nEnable the auto update option,env will auto update the packages you select.")
245242

246-
if find_macro_in_condfig(fn, 'SYS_AUTO_UPDATE_PKGS'):
243+
if find_macro_in_config(fn, 'SYS_AUTO_UPDATE_PKGS'):
247244
os.system('pkgs --update')
248-
print "Auto update packages done"
245+
print "==============================>The packages have been updated completely."
249246

250-
print("Select the project type your bsp support and then env will create a new mdk/iar project.")
251-
252-
if find_macro_in_condfig(fn, 'SYS_CREATE_MDK_IAR_PROJECT'):
253-
if find_macro_in_condfig(fn, 'SYS_CREATE_MDK4'):
247+
if find_macro_in_config(fn, 'SYS_CREATE_MDK_IAR_PROJECT'):
248+
if find_macro_in_config(fn, 'SYS_CREATE_MDK4'):
254249
os.system('scons --target=mdk4 -s')
255250
print "Create mdk4 project done"
256-
elif find_macro_in_condfig(fn, 'SYS_CREATE_MDK5'):
251+
elif find_macro_in_config(fn, 'SYS_CREATE_MDK5'):
257252
os.system('scons --target=mdk5 -s')
258253
print "Create mdk5 project done"
259-
elif find_macro_in_condfig(fn, 'SYS_CREATE_IAR'):
254+
elif find_macro_in_config(fn, 'SYS_CREATE_IAR'):
260255
os.system('scons --target=iar -s')
261256
print "Create iar project done"
262257

0 commit comments

Comments
 (0)