@@ -81,14 +81,15 @@ def run(args, verbose=False):
81
81
82
82
def stage0_data (rust_root ):
83
83
nightlies = os .path .join (rust_root , "src/stage0.txt" )
84
+ data = {}
84
85
with open (nightlies , 'r' ) as nightlies :
85
- data = {}
86
- for line in nightlies . read (). split ( " \n " ):
86
+ for line in nightlies :
87
+ line = line . rstrip () # Strip newline character, '\n'
87
88
if line .startswith ("#" ) or line == '' :
88
89
continue
89
90
a , b = line .split (": " , 1 )
90
91
data [a ] = b
91
- return data
92
+ return data
92
93
93
94
class RustBuild :
94
95
def download_stage0 (self ):
@@ -219,7 +220,7 @@ def build_bootstrap(self):
219
220
env )
220
221
221
222
def run (self , args , env ):
222
- proc = subprocess .Popen (args , env = env )
223
+ proc = subprocess .Popen (args , env = env )
223
224
ret = proc .wait ()
224
225
if ret != 0 :
225
226
sys .exit (ret )
@@ -234,20 +235,19 @@ def build_triple(self):
234
235
try :
235
236
ostype = subprocess .check_output (['uname' , '-s' ]).strip ()
236
237
cputype = subprocess .check_output (['uname' , '-m' ]).strip ()
237
- except FileNotFoundError :
238
+ except subprocess . CalledProcessError :
238
239
if sys .platform == 'win32' :
239
240
return 'x86_64-pc-windows-msvc'
240
- else :
241
- err = "uname not found"
242
- if self .verbose :
243
- raise Exception (err )
244
- sys .exit (err )
241
+ err = "uname not found"
242
+ if self .verbose :
243
+ raise Exception (err )
244
+ sys .exit (err )
245
245
246
246
# Darwin's `uname -s` lies and always returns i386. We have to use
247
247
# sysctl instead.
248
248
if ostype == 'Darwin' and cputype == 'i686' :
249
249
sysctl = subprocess .check_output (['sysctl' , 'hw.optional.x86_64' ])
250
- if sysctl . contains ( ': 1' ) :
250
+ if ': 1' in sysctl :
251
251
cputype = 'x86_64'
252
252
253
253
# The goal here is to come up with the same triple as LLVM would,
0 commit comments