aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/platform/base.py
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-09-19 10:57:27 +0200
committerGitHub <noreply@github.com>2023-09-19 08:57:27 +0000
commit7caac9790d772776a036ef239d87e426a2312b00 (patch)
tree46ac54a1bc2d4d419a2e47f952ce25ce810ab47b /python/servo/platform/base.py
parent576887907c17d99ab56d52e40c505f0db3def20d (diff)
downloadservo-7caac9790d772776a036ef239d87e426a2312b00.tar.gz
servo-7caac9790d772776a036ef239d87e426a2312b00.zip
Enforce formatting of TOML files (#30128)
* Fmt all toml files * bootstrap taplo * enforce toml formatting with taplo * Install taplo in CI using cargo-install action
Diffstat (limited to 'python/servo/platform/base.py')
-rw-r--r--python/servo/platform/base.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/python/servo/platform/base.py b/python/servo/platform/base.py
index 7fde2b60c97..8af3e2056eb 100644
--- a/python/servo/platform/base.py
+++ b/python/servo/platform/base.py
@@ -8,6 +8,7 @@
# except according to those terms.
import os
+import shutil
import subprocess
from typing import Dict, Optional
@@ -96,9 +97,21 @@ class Base:
)
def bootstrap(self, force: bool):
- if not self._platform_bootstrap(force):
+ installed_something = self._platform_bootstrap(force)
+ installed_something |= self.install_taplo(force)
+ if not installed_something:
print("Dependencies were already installed!")
+ def install_taplo(self, force: bool) -> bool:
+ if not force and shutil.which("taplo") is not None:
+ return False
+
+ if subprocess.call(["cargo", "install", "taplo-cli", "--locked"],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
+ raise EnvironmentError("Installation of taplo failed.")
+
+ return True
+
def passive_bootstrap(self) -> bool:
"""A bootstrap method that is called without explicitly invoking `./mach bootstrap`
but that is executed in the process of other `./mach` commands. This should be