diff options
| author | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2016-04-21 23:07:51 +0200 |
|---|---|---|
| committer | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2016-04-26 00:34:19 +0200 |
| commit | a422b7e4ed8bc8a05777eced718156f47eaa861b (patch) | |
| tree | 1df0c728b7d7b4353de1bb900829983025d3f4af /src/bootstrap | |
| parent | a264f5b7e8df34c4bf7f10d0c6c7f9ab805ee672 (diff) | |
| download | rust-a422b7e4ed8bc8a05777eced718156f47eaa861b.tar.gz rust-a422b7e4ed8bc8a05777eced718156f47eaa861b.zip | |
some Python nits and fixes
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/bootstrap.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index a05700c1af4..73022b99a8f 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -81,14 +81,15 @@ def run(args, verbose=False): def stage0_data(rust_root): nightlies = os.path.join(rust_root, "src/stage0.txt") + data = {} with open(nightlies, 'r') as nightlies: - data = {} - for line in nightlies.read().split("\n"): + for line in nightlies: + line = line.rstrip() # Strip newline character, '\n' if line.startswith("#") or line == '': continue a, b = line.split(": ", 1) data[a] = b - return data + return data class RustBuild: def download_stage0(self): @@ -219,7 +220,7 @@ class RustBuild: env) def run(self, args, env): - proc = subprocess.Popen(args, env = env) + proc = subprocess.Popen(args, env=env) ret = proc.wait() if ret != 0: sys.exit(ret) @@ -234,20 +235,19 @@ class RustBuild: try: ostype = subprocess.check_output(['uname', '-s']).strip() cputype = subprocess.check_output(['uname', '-m']).strip() - except FileNotFoundError: + except subprocess.CalledProcessError: if sys.platform == 'win32': return 'x86_64-pc-windows-msvc' - else: - err = "uname not found" - if self.verbose: - raise Exception(err) - sys.exit(err) + err = "uname not found" + if self.verbose: + raise Exception(err) + sys.exit(err) # Darwin's `uname -s` lies and always returns i386. We have to use # sysctl instead. if ostype == 'Darwin' and cputype == 'i686': sysctl = subprocess.check_output(['sysctl', 'hw.optional.x86_64']) - if sysctl.contains(': 1'): + if ': 1' in sysctl: cputype = 'x86_64' # The goal here is to come up with the same triple as LLVM would, |
