mach: Install Rust toolchain during bootstrap if needed (#35795)

Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
Delan Azabani 2025-03-05 13:05:29 +08:00 committed by GitHub
parent 3409ab668a
commit d9ea724abd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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