diff options
| author | bors <bors@rust-lang.org> | 2016-06-03 12:37:01 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-06-03 12:37:01 -0700 |
| commit | 7de2e6dc828473b60aefe4d2140a602cbeb6d6f9 (patch) | |
| tree | 13483b57bca838159a2983b528da1d0255f401ab | |
| parent | 1ceaa86e0adfcee66e549e975b2afeeb7ae8a34b (diff) | |
| parent | cde72b071c4a955d9e087a95cdf15398ac5edb30 (diff) | |
| download | rust-7de2e6dc828473b60aefe4d2140a602cbeb6d6f9.tar.gz rust-7de2e6dc828473b60aefe4d2140a602cbeb6d6f9.zip | |
Auto merge of #34020 - Stebalien:py-cleanup, r=alexcrichton
Avoid repeated string concatenation in python While performance isn't really critical here, IMO, format strings are more readable. /end nit
| -rw-r--r-- | src/bootstrap/bootstrap.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index d69d4b96249..cfdc248c1ea 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -30,7 +30,7 @@ def get(url, path, verbose=False): download(sha_path, sha_url, verbose) download(temp_path, url, verbose) verify(temp_path, sha_path, verbose) - print("moving " + temp_path + " to " + path) + print("moving {} to {}".format(temp_path, path)) shutil.move(temp_path, path) finally: delete_if_present(sha_path) @@ -44,7 +44,7 @@ def delete_if_present(path): def download(path, url, verbose): - print("downloading " + url + " to " + path) + print("downloading {} to {}".format(url, path)) # see http://serverfault.com/questions/301128/how-to-download if sys.platform == 'win32': run(["PowerShell.exe", "/nologo", "-Command", @@ -133,20 +133,20 @@ class RustBuild: if os.path.exists(self.bin_root()): shutil.rmtree(self.bin_root()) channel = self.stage0_rustc_channel() - filename = "rust-std-" + channel + "-" + self.build + ".tar.gz" + filename = "rust-std-{}-{}.tar.gz".format(channel, self.build) url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date() tarball = os.path.join(rustc_cache, filename) if not os.path.exists(tarball): - get(url + "/" + filename, tarball, verbose=self.verbose) + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), match="rust-std-" + self.build, verbose=self.verbose) - filename = "rustc-" + channel + "-" + self.build + ".tar.gz" + filename = "rustc-{}-{}.tar.gz".format(channel, self.build) url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date() tarball = os.path.join(rustc_cache, filename) if not os.path.exists(tarball): - get(url + "/" + filename, tarball, verbose=self.verbose) + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), match="rustc", verbose=self.verbose) with open(self.rustc_stamp(), 'w') as f: f.write(self.stage0_rustc_date()) @@ -154,11 +154,11 @@ class RustBuild: if self.cargo().startswith(self.bin_root()) and \ (not os.path.exists(self.cargo()) or self.cargo_out_of_date()): channel = self.stage0_cargo_channel() - filename = "cargo-" + channel + "-" + self.build + ".tar.gz" + filename = "cargo-{}-{}.tar.gz".format(channel, self.build) url = "https://static.rust-lang.org/cargo-dist/" + self.stage0_cargo_date() tarball = os.path.join(cargo_cache, filename) if not os.path.exists(tarball): - get(url + "/" + filename, tarball, verbose=self.verbose) + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose) with open(self.cargo_stamp(), 'w') as f: f.write(self.stage0_cargo_date()) @@ -335,7 +335,7 @@ class RustBuild: raise ValueError(err) sys.exit(err) - return cputype + '-' + ostype + return "{}-{}".format(cputype, ostype) def main(): parser = argparse.ArgumentParser(description='Build rust') |
