Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ ENV/

# mypy
.mypy_cache/
.vscode/settings.json
cmds/.config.old
/cmds/.config
19 changes: 11 additions & 8 deletions archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def unpack(archive_fn, path, pkg, pkgs_name_in_json):

def packtest(path):
ret = True
if ".zip" in path:

if path.find(".zip") != -1:
try:
if zipfile.is_zipfile(path):
# Test zip again to make sure it's a right zip file.
Expand All @@ -114,24 +115,26 @@ def packtest(path):
else:
ret = False
print('package check error. \n')
except Exception, e:
print('packtest e.message:%s\t' % e.message)
# arch.close()
except Exception as e:
print('packtest error message:%s\t' % e)
print("The archive package is broken. \n")
arch.close()
ret = False

if ".tar.bz2" in path:
# if ".tar.bz2" in path:.
if path.find(".tar.bz2") != -1:
try:
if not tarfile.is_tarfile(path):
ret = False
except Exception, e:
except Exception as e:
ret = False

if ".tar.gz" in path:
# if ".tar.gz" in path:
if path.find(".tar.gz") != -1:
try:
if not tarfile.is_tarfile(path):
ret = False
except Exception, e:
except Exception as e:
ret = False

return ret
15 changes: 8 additions & 7 deletions cmds/cmd_menuconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def mk_rtconfig(filename):

def find_macro_in_config(filename, macro_name):
try:
config = file(filename)
config = open(filename, "r")
except:
print 'open .config failed'
print('open .config failed')
return

empty_line = 1
Expand Down Expand Up @@ -141,6 +141,7 @@ def find_macro_in_config(filename, macro_name):
if setting[0] == macro_name and setting[1] == 'y':
return True

config.close()
return False


Expand Down Expand Up @@ -178,7 +179,7 @@ def cmd(args):
os.system('chcp 437 > nul')

if args.menuconfig_fn:
print 'use', args.menuconfig_fn
print('use', args.menuconfig_fn)
import shutil
shutil.copy(args.menuconfig_fn, fn)
elif args.menuconfig_g:
Expand Down Expand Up @@ -236,18 +237,18 @@ def cmd(args):

if find_macro_in_config(fn, 'SYS_AUTO_UPDATE_PKGS'):
os.system('pkgs --update')
print "==============================>The packages have been updated completely."
print("==============================>The packages have been updated completely.")

if find_macro_in_config(fn, 'SYS_CREATE_MDK_IAR_PROJECT'):
if find_macro_in_config(fn, 'SYS_CREATE_MDK4'):
os.system('scons --target=mdk4 -s')
print "Create mdk4 project done"
print("Create mdk4 project done")
elif find_macro_in_config(fn, 'SYS_CREATE_MDK5'):
os.system('scons --target=mdk5 -s')
print "Create mdk5 project done"
print("Create mdk5 project done")
elif find_macro_in_config(fn, 'SYS_CREATE_IAR'):
os.system('scons --target=iar -s')
print "Create iar project done"
print("Create iar project done")


def add_parser(sub):
Expand Down
Loading