Skip to content

Commit 58d03ad

Browse files
committed
Fix PEP8 in maketest
1 parent 04408fa commit 58d03ad

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/etc/maketest.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
import os
1313
import sys
1414

15-
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
16-
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
17-
# the value is list of paths.
18-
# (if there is only one path, it becomes `c:/real/abs/path`.)
19-
# this causes great confusion and error: shell and Makefile doesn't like
20-
# windows paths so it is really error-prone. revert it for peace.
15+
2116
def normalize_path(v):
17+
"""msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
18+
`c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
19+
the value is list of paths.
20+
(if there is only one path, it becomes `c:/real/abs/path`.)
21+
this causes great confusion and error: shell and Makefile doesn't like
22+
windows paths so it is really error-prone. revert it for peace."""
2223
v = v.replace('\\', '/')
2324
# c:/path -> /c/path
2425
if ':/' in v:
@@ -31,6 +32,7 @@ def putenv(name, value):
3132
value = normalize_path(value)
3233
os.putenv(name, value)
3334

35+
3436
def convert_path_spec(name, value):
3537
if os.name == 'nt' and name != 'PATH':
3638
value = ":".join(normalize_path(v) for v in value.split(";"))
@@ -42,14 +44,14 @@ def convert_path_spec(name, value):
4244
putenv('CC', sys.argv[5])
4345
putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
4446
filt = sys.argv[7]
45-
putenv('LD_LIB_PATH_ENVVAR', sys.argv[8]);
46-
putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]));
47-
putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]));
47+
putenv('LD_LIB_PATH_ENVVAR', sys.argv[8])
48+
putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]))
49+
putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]))
4850
putenv('RUST_BUILD_STAGE', sys.argv[11])
4951
putenv('S', os.path.abspath(sys.argv[12]))
5052
putenv('PYTHON', sys.executable)
5153

52-
if not filt in sys.argv[1]:
54+
if filt not in sys.argv[1]:
5355
sys.exit(0)
5456
print('maketest: ' + os.path.basename(os.path.dirname(sys.argv[1])))
5557

@@ -63,19 +65,19 @@ def convert_path_spec(name, value):
6365
path = path[:-1]
6466

6567
proc = subprocess.Popen([make, '-C', path],
66-
stdout = subprocess.PIPE,
67-
stderr = subprocess.PIPE)
68+
stdout=subprocess.PIPE,
69+
stderr=subprocess.PIPE)
6870
out, err = proc.communicate()
6971
i = proc.wait()
7072

7173
if i != 0:
72-
73-
print '----- ' + sys.argv[1] + """ --------------------
74+
print """\
75+
----- %s --------------------
7476
------ stdout ---------------------------------------------
75-
""" + out + """
77+
%s
7678
------ stderr ---------------------------------------------
77-
""" + err + """
79+
%s
7880
------ ---------------------------------------------
79-
"""
80-
sys.exit(i)
81+
""" % (sys.argv[1], out, err)
8182

83+
sys.exit(i)

0 commit comments

Comments
 (0)