From d9ea724abd65d89f00a8fee15396c993701d0423 Mon Sep 17 00:00:00 2001 From: Delan Azabani Date: Wed, 5 Mar 2025 13:05:29 +0800 Subject: mach: Install Rust toolchain during bootstrap if needed (#35795) Signed-off-by: Delan Azabani --- python/servo/platform/base.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/servo/platform/base.py') diff --git a/python/servo/platform/base.py b/python/servo/platform/base.py index 81963777a80..0f2bf25de15 100644 --- a/python/servo/platform/base.py +++ b/python/servo/platform/base.py @@ -60,6 +60,7 @@ class Base: installed_something = False if not skip_platform: installed_something |= self._platform_bootstrap(force) + self.install_rust_toolchain() if not skip_lints: installed_something |= self.install_taplo(force) installed_something |= self.install_cargo_deny(force) @@ -68,6 +69,14 @@ class Base: if not installed_something: print("Dependencies were already installed!") + def install_rust_toolchain(self): + # rustup 1.28.0, and rustup 1.28.1+ with RUSTUP_AUTO_INSTALL=0, require us to explicitly + # install the Rust toolchain before trying to use it. + print(" * Installing Rust toolchain...") + if subprocess.call(["rustup", "show", "active-toolchain"]) != 0: + if subprocess.call(["rustup", "toolchain", "install"]) != 0: + raise EnvironmentError("Installation of Rust toolchain failed.") + def install_taplo(self, force: bool) -> bool: if not force and shutil.which("taplo") is not None: return False -- cgit v1.2.3