Skip to content

Commit c9bf5c0

Browse files
committed
bootstrap: allow specifying mirror for bootstrap compiler download.
1 parent 7e0afda commit c9bf5c0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/bootstrap/bootstrap.py

+14-2
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")
@@ -731,9 +731,19 @@ def update_submodules(self):
731731
self.update_submodule(module[0], module[1], recorded_submodules)
732732
print("Submodules updated in %.2f seconds" % (time() - start_time))
733733

734+
def set_normal_environment(self):
735+
"""Set download URL for normal environment"""
736+
if 'RUSTUP_DIST_SERVER' in os.environ:
737+
self._download_url = os.environ['RUSTUP_DIST_SERVER']
738+
else:
739+
self._download_url = 'https://static.rust-lang.org'
740+
734741
def set_dev_environment(self):
735742
"""Set download URL for development environment"""
736-
self._download_url = 'https://dev-static.rust-lang.org'
743+
if 'RUSTUP_DEV_DIST_SERVER' in os.environ:
744+
self._download_url = os.environ['RUSTUP_DEV_DIST_SERVER']
745+
else:
746+
self._download_url = 'https://dev-static.rust-lang.org'
737747

738748
def check_vendored_status(self):
739749
"""Check that vendoring is configured properly"""
@@ -826,6 +836,8 @@ def bootstrap(help_triggered):
826836

827837
if 'dev' in data:
828838
build.set_dev_environment()
839+
else:
840+
build.set_normal_environment()
829841

830842
build.update_submodules()
831843

0 commit comments

Comments
 (0)