55# can run it "fast": spawning zillions of windows processes is our major build
66# bottleneck (and it doesn't hurt to run faster on other platforms as well).
77
8- import sys , os , re , codecs
8+ import sys
9+ import os
10+ import codecs
11+
912
1013def scrub (b ):
11- if sys .version_info >= (3 ,) and type (b ) == bytes :
12- return b .decode ('ascii' )
13- else :
14- return b
14+ if sys .version_info >= (3 ,) and type (b ) == bytes :
15+ return b .decode ('ascii' )
16+ else :
17+ return b
1518
1619src_dir = scrub (os .getenv ("CFG_SRC_DIR" ))
1720if not src_dir :
18- raise Exception ("missing env var CFG_SRC_DIR" )
21+ raise Exception ("missing env var CFG_SRC_DIR" )
1922
2023run_pass = os .path .join (src_dir , "src" , "test" , "run-pass" )
2124run_pass = os .path .abspath (run_pass )
2225stage2_tests = []
2326
2427for t in os .listdir (run_pass ):
2528 if t .endswith (".rs" ) and not (
26- t .startswith ("." ) or t .startswith ("#" ) or t .startswith ("~" )):
29+ t .startswith ("." ) or t .startswith ("#" ) or t .startswith ("~" )):
2730 f = codecs .open (os .path .join (run_pass , t ), "r" , "utf8" )
2831 s = f .read ()
2932 if not ("xfail-test" in s or
@@ -41,10 +44,11 @@ def scrub(b):
4144c .write ("// AUTO-GENERATED FILE: DO NOT EDIT\n " )
4245c .write ("#[link(name=\" run_pass_stage2\" , vers=\" 0.1\" )];\n " )
4346c .write ("#[feature(globs, macro_rules, struct_variant, managed_boxes)];\n " )
47+ c .write ("#[allow(attribute_usage)];\n " )
4448for t in stage2_tests :
4549 p = os .path .join (run_pass , t )
4650 p = p .replace ("\\ " , "\\ \\ " )
47- c .write ("#[path = \" %s\" ]" % p );
51+ c .write ("#[path = \" %s\" ]" % p )
4852 c .write ("pub mod t_%d;\n " % i )
4953 i += 1
5054c .close ()
@@ -56,10 +60,10 @@ def scrub(b):
5660d .write ("extern mod extra;\n " )
5761d .write ("extern mod run_pass_stage2;\n " )
5862d .write ("use run_pass_stage2::*;\n " )
59- d .write ("use std::io;\n " );
60- d .write ("use std::io::Writer;\n " );
61- d .write ("fn main() {\n " );
62- d .write (" let mut out = io::stdout();\n " );
63+ d .write ("use std::io;\n " )
64+ d .write ("use std::io::Writer;\n " )
65+ d .write ("fn main() {\n " )
66+ d .write (" let mut out = io::stdout();\n " )
6367i = 0
6468for t in stage2_tests :
6569 p = os .path .join ("test" , "run-pass" , t )
0 commit comments