Skip to content

Commit 78e728e

Browse files
authored
Rollup merge of rust-lang#63953 - crlf0710:bootstrap_mirroring, r=Mark-Simulacrum
bootstrap: allow specifying mirror for bootstrap compiler download.
2 parents 1ea8fc5 + c9bf5c0 commit 78e728e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/bootstrap/bootstrap.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class RustBuild(object):
320320
def __init__(self):
321321
self.cargo_channel = ''
322322
self.date = ''
323-
self._download_url = 'https://static.rust-lang.org'
323+
self._download_url = ''
324324
self.rustc_channel = ''
325325
self.build = ''
326326
self.build_dir = os.path.join(os.getcwd(), "build")
@@ -733,9 +733,19 @@ def update_submodules(self):
733733
self.update_submodule(module[0], module[1], recorded_submodules)
734734
print("Submodules updated in %.2f seconds" % (time() - start_time))
735735

736+
def set_normal_environment(self):
737+
"""Set download URL for normal environment"""
738+
if 'RUSTUP_DIST_SERVER' in os.environ:
739+
self._download_url = os.environ['RUSTUP_DIST_SERVER']
740+
else:
741+
self._download_url = 'https://static.rust-lang.org'
742+
736743
def set_dev_environment(self):
737744
"""Set download URL for development environment"""
738-
self._download_url = 'https://dev-static.rust-lang.org'
745+
if 'RUSTUP_DEV_DIST_SERVER' in os.environ:
746+
self._download_url = os.environ['RUSTUP_DEV_DIST_SERVER']
747+
else:
748+
self._download_url = 'https://dev-static.rust-lang.org'
739749

740750
def check_vendored_status(self):
741751
"""Check that vendoring is configured properly"""
@@ -828,6 +838,8 @@ def bootstrap(help_triggered):
828838

829839
if 'dev' in data:
830840
build.set_dev_environment()
841+
else:
842+
build.set_normal_environment()
831843

832844
build.update_submodules()
833845

0 commit comments

Comments
 (0)