@@ -108,14 +108,15 @@ def run(args, verbose=False):
108
108
109
109
def stage0_data (rust_root ):
110
110
nightlies = os .path .join (rust_root , "src/stage0.txt" )
111
+ data = {}
111
112
with open (nightlies , 'r' ) as nightlies :
112
- data = {}
113
- for line in nightlies . read (). split ( " \n " ):
113
+ for line in nightlies :
114
+ line = line . rstrip () # Strip newline character, '\n'
114
115
if line .startswith ("#" ) or line == '' :
115
116
continue
116
117
a , b = line .split (": " , 1 )
117
118
data [a ] = b
118
- return data
119
+ return data
119
120
120
121
class RustBuild :
121
122
def download_stage0 (self ):
@@ -246,7 +247,7 @@ def build_bootstrap(self):
246
247
env )
247
248
248
249
def run (self , args , env ):
249
- proc = subprocess .Popen (args , env = env )
250
+ proc = subprocess .Popen (args , env = env )
250
251
ret = proc .wait ()
251
252
if ret != 0 :
252
253
sys .exit (ret )
@@ -261,20 +262,19 @@ def build_triple(self):
261
262
try :
262
263
ostype = subprocess .check_output (['uname' , '-s' ]).strip ()
263
264
cputype = subprocess .check_output (['uname' , '-m' ]).strip ()
264
- except FileNotFoundError :
265
+ except subprocess . CalledProcessError :
265
266
if sys .platform == 'win32' :
266
267
return 'x86_64-pc-windows-msvc'
267
- else :
268
- err = "uname not found"
269
- if self .verbose :
270
- raise Exception (err )
271
- sys .exit (err )
268
+ err = "uname not found"
269
+ if self .verbose :
270
+ raise Exception (err )
271
+ sys .exit (err )
272
272
273
273
# Darwin's `uname -s` lies and always returns i386. We have to use
274
274
# sysctl instead.
275
275
if ostype == 'Darwin' and cputype == 'i686' :
276
276
sysctl = subprocess .check_output (['sysctl' , 'hw.optional.x86_64' ])
277
- if sysctl . contains ( ': 1' ) :
277
+ if ': 1' in sysctl :
278
278
cputype = 'x86_64'
279
279
280
280
# The goal here is to come up with the same triple as LLVM would,
0 commit comments