12
12
import os
13
13
import sys
14
14
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
+
21
16
def normalize_path (v ):
17
+ """msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
18
+ `c:\r eal\a bs\path1;c:\r eal\a bs\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."""
22
23
v = v .replace ('\\ ' , '/' )
23
24
# c:/path -> /c/path
24
25
if ':/' in v :
@@ -31,6 +32,7 @@ def putenv(name, value):
31
32
value = normalize_path (value )
32
33
os .putenv (name , value )
33
34
35
+
34
36
def convert_path_spec (name , value ):
35
37
if os .name == 'nt' and name != 'PATH' :
36
38
value = ":" .join (normalize_path (v ) for v in value .split (";" ))
@@ -42,14 +44,14 @@ def convert_path_spec(name, value):
42
44
putenv ('CC' , sys .argv [5 ])
43
45
putenv ('RUSTDOC' , os .path .abspath (sys .argv [6 ]))
44
46
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 ]))
48
50
putenv ('RUST_BUILD_STAGE' , sys .argv [11 ])
49
51
putenv ('S' , os .path .abspath (sys .argv [12 ]))
50
52
putenv ('PYTHON' , sys .executable )
51
53
52
- if not filt in sys .argv [1 ]:
54
+ if filt not in sys .argv [1 ]:
53
55
sys .exit (0 )
54
56
print ('maketest: ' + os .path .basename (os .path .dirname (sys .argv [1 ])))
55
57
@@ -63,19 +65,19 @@ def convert_path_spec(name, value):
63
65
path = path [:- 1 ]
64
66
65
67
proc = subprocess .Popen ([make , '-C' , path ],
66
- stdout = subprocess .PIPE ,
67
- stderr = subprocess .PIPE )
68
+ stdout = subprocess .PIPE ,
69
+ stderr = subprocess .PIPE )
68
70
out , err = proc .communicate ()
69
71
i = proc .wait ()
70
72
71
73
if i != 0 :
72
-
73
- print ' ----- ' + sys . argv [ 1 ] + """ --------------------
74
+ print """ \
75
+ ----- %s --------------------
74
76
------ stdout ---------------------------------------------
75
- """ + out + """
77
+ %s
76
78
------ stderr ---------------------------------------------
77
- """ + err + """
79
+ %s
78
80
------ ---------------------------------------------
79
- """
80
- sys .exit (i )
81
+ """ % (sys .argv [1 ], out , err )
81
82
83
+ sys .exit (i )
0 commit comments