From fa4639195c3e3b010df68dcbc9f908dd57282894 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 16 Apr 2023 21:34:55 +0200 Subject: [PATCH] bootstrap.py: Use loop for `_download_component_helper` --- src/bootstrap/bootstrap.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 31546d195173..9e4c0d2b1679 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -437,16 +437,17 @@ class RustBuild(object): os.makedirs(rustc_cache) tarball_suffix = '.tar.gz' if lzma is None else '.tar.xz' - filename = "rust-std-{}-{}{}".format( - rustc_channel, self.build, tarball_suffix) - pattern = "rust-std-{}".format(self.build) - self._download_component_helper(filename, pattern, tarball_suffix, rustc_cache) - filename = "rustc-{}-{}{}".format(rustc_channel, self.build, - tarball_suffix) - self._download_component_helper(filename, "rustc", tarball_suffix, rustc_cache) - filename = "cargo-{}-{}{}".format(rustc_channel, self.build, - tarball_suffix) - self._download_component_helper(filename, "cargo", tarball_suffix, rustc_cache) + + tarballs_to_download = [ + ("rust-std-{}-{}{}".format(rustc_channel, self.build, tarball_suffix), + "rust-std-{}".format(self.build)), + ("rustc-{}-{}{}".format(rustc_channel, self.build, tarball_suffix), "rustc"), + ("cargo-{}-{}{}".format(rustc_channel, self.build, tarball_suffix), "cargo"), + ] + + for filename, pattern in tarballs_to_download: + self._download_component_helper(filename, pattern, tarball_suffix, rustc_cache) + if self.should_fix_bins_and_dylibs(): self.fix_bin_or_dylib("{}/bin/cargo".format(bin_root))