aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/platform/base.py
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2025-03-05 13:05:29 +0800
committerGitHub <noreply@github.com>2025-03-05 05:05:29 +0000
commitd9ea724abd65d89f00a8fee15396c993701d0423 (patch)
tree8fdf7bc8e2016386a5e0560452e852ef8f17ce46 /python/servo/platform/base.py
parent3409ab668aa4ba2b34c02be0a07af9fe8cb8a214 (diff)
downloadservo-d9ea724abd65d89f00a8fee15396c993701d0423.tar.gz
servo-d9ea724abd65d89f00a8fee15396c993701d0423.zip
mach: Install Rust toolchain during bootstrap if needed (#35795)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Diffstat (limited to 'python/servo/platform/base.py')
-rw-r--r--python/servo/platform/base.py9
1 files changed, 9 insertions, 0 deletions
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