Skip to content

Commit bc6a604

Browse files
authored
Merge pull request #1 from SummerGGift/chinese_style
Chinese style
2 parents 61e8cad + 8fb9373 commit bc6a604

File tree

6 files changed

+151
-116
lines changed

6 files changed

+151
-116
lines changed

archive.py

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,17 @@
3030

3131

3232
def unpack(archive_fn, path, pkg, pkgs_name_in_json):
33-
33+
pkg_ver = pkg['ver']
3434
flag = True
35-
36-
#print(pkg)
37-
35+
3836
if ".tar.bz2" in archive_fn:
3937
arch = tarfile.open(archive_fn, "r:bz2")
4038
for tarinfo in arch:
4139
arch.extract(tarinfo, path)
4240
a = tarinfo.name
4341
if not os.path.isdir(os.path.join(path, a)):
4442
right_path = a.replace('/', '\\')
45-
a = os.path.join(os.path.split(right_path)[
46-
0], os.path.split(right_path)[1])
43+
a = os.path.join(os.path.split(right_path)[0], os.path.split(right_path)[1])
4744
pkgsdb.savetodb(a, archive_fn)
4845
arch.close()
4946

@@ -54,8 +51,7 @@ def unpack(archive_fn, path, pkg, pkgs_name_in_json):
5451
a = tarinfo.name
5552
if not os.path.isdir(os.path.join(path, a)):
5653
right_path = a.replace('/', '\\')
57-
a = os.path.join(os.path.split(right_path)[
58-
0], os.path.split(right_path)[1])
54+
a = os.path.join(os.path.split(right_path)[0], os.path.split(right_path)[1])
5955
pkgsdb.savetodb(a, archive_fn)
6056
arch.close()
6157

@@ -68,22 +64,17 @@ def unpack(archive_fn, path, pkg, pkgs_name_in_json):
6864
# Gets the folder name and change_dirname only once
6965
if flag:
7066
dir_name = os.path.split(right_path)[0]
71-
change_dirname = pkgs_name_in_json + '-' + pkg['ver']
67+
change_dirname = pkgs_name_in_json + '-' + pkg_ver
7268
flag = False
7369

74-
right_name_to_db = right_path.replace(
75-
dir_name, change_dirname, 1)
76-
#print(right_name_to_db)
70+
right_name_to_db = right_path.replace(dir_name, change_dirname, 1)
7771
pkgsdb.savetodb(right_name_to_db, archive_fn, right_path)
7872
arch.close()
7973

80-
#Change the folder name
81-
82-
change_dirname = pkgs_name_in_json + '-' + pkg['ver']
83-
#print(os.path.join(path, dir_name))
84-
#print(os.path.join(path, change_dirname))
85-
#print(pkgs_name_in_json)
74+
# Change the folder name
8675

76+
change_dirname = pkgs_name_in_json + '-' + pkg_ver
77+
8778
if os.path.isdir(os.path.join(path, change_dirname)):
8879
cmd = 'rd /s /q ' + os.path.join(path, change_dirname)
8980
os.system(cmd)
@@ -96,28 +87,32 @@ def packtest(path):
9687
if ".zip" in path:
9788
try:
9889
if zipfile.is_zipfile(path):
99-
# test zip again to make sure it's a right zip file.
90+
# Test zip again to make sure it's a right zip file.
10091
arch = zipfile.ZipFile(path, "r")
10192
if arch.testzip():
10293
ret = False
103-
arch.close()
94+
arch.close()
95+
else:
96+
ret = False
97+
print('package check error. \n')
10498
except Exception, e:
105-
print('e.message:%s\t'%e.message)
106-
arch.close()
99+
print('packtest e.message:%s\t' % e.message)
100+
# arch.close()
101+
print("The archive package is broken. \n")
107102
ret = False
108-
103+
109104
if ".tar.bz2" in path:
110105
try:
111106
if not tarfile.is_tarfile(path):
112-
ret = False
107+
ret = False
113108
except Exception, e:
114109
ret = False
115110

116111
if ".tar.gz" in path:
117112
try:
118113
if not tarfile.is_tarfile(path):
119-
ret = False
114+
ret = False
120115
except Exception, e:
121116
ret = False
122-
117+
123118
return ret

cmds/cmd_menuconfig.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ def cmd(args):
185185
else:
186186
mtime = -1
187187

188+
os.system('chcp 437 > nul')
189+
188190
if args.menuconfig_fn:
189191
print 'use', args.menuconfig_fn
190192
import shutil
@@ -194,6 +196,7 @@ def cmd(args):
194196
elif args.menuconfig_silent:
195197
if float(os_version) >= 6.2:
196198
os.system('kconfig-mconf Kconfig -n')
199+
mk_rtconfig(fn)
197200
else:
198201
if os.path.isfile(kconfig_win7_path):
199202
os.system('kconfig-mconf_win7 Kconfig -n')
@@ -232,6 +235,8 @@ def cmd(args):
232235
if mtime != mtime2:
233236
mk_rtconfig(fn)
234237

238+
os.system('chcp 65001 > nul')
239+
235240
if platform.system() == "Windows":
236241
env_kconfig_path = os.path.join(env_root, 'tools\scripts\cmds')
237242
fn = os.path.join(env_kconfig_path, '.config')

0 commit comments

Comments
 (0)