aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2020-01-02 14:28:57 +0100
committerSimon Sapin <simon.sapin@exyr.org>2020-01-02 15:30:33 +0100
commit855601ebb47282c1e3a2389979b7cae8247b3f69 (patch)
tree206047e7e15951eaa07da8d0afc56dc3bab98702 /python/servo/command_base.py
parentd4da65d1497d6567415573117f7e0151e5c16050 (diff)
downloadservo-855601ebb47282c1e3a2389979b7cae8247b3f69.tar.gz
servo-855601ebb47282c1e3a2389979b7cae8247b3f69.zip
mach: check rustup version in `ensure_bootstrapped()`
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 283a741aee3..02c4b25c4cf 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -360,20 +360,7 @@ class CommandBase(object):
def call_rustup_run(self, args, **kwargs):
if self.config["tools"]["use-rustup"]:
- try:
- version_line = subprocess.check_output(["rustup" + BIN_SUFFIX, "--version"])
- except OSError as e:
- if e.errno == NO_SUCH_FILE_OR_DIRECTORY:
- print("It looks like rustup is not installed. See instructions at "
- "https://github.com/servo/servo/#setting-up-your-environment")
- print()
- return 1
- raise
- version = tuple(map(int, re.match(b"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups()))
- if version < (1, 11, 0):
- print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version)
- print("Try running 'rustup self update'.")
- return 1
+ self.ensure_rustup_version()
args = ["rustup" + BIN_SUFFIX, "run", "--install", self.rust_toolchain()] + args
else:
args[0] += BIN_SUFFIX
@@ -1017,8 +1004,9 @@ install them, let us know by filing a bug!")
if "msvc" in target_platform:
Registrar.dispatch("bootstrap", context=self.context)
- if target:
- if self.config["tools"]["use-rustup"] and not "uwp" in target:
+ if self.config["tools"]["use-rustup"]:
+ self.ensure_rustup_version()
+ if target and "uwp" not in target:
# 'rustup target add' fails if the toolchain is not installed at all.
self.call_rustup_run(["rustc", "--version"])
@@ -1028,6 +1016,22 @@ install them, let us know by filing a bug!")
self.context.bootstrapped = True
+ def ensure_rustup_version(self):
+ try:
+ version_line = subprocess.check_output(["rustup" + BIN_SUFFIX, "--version"])
+ except OSError as e:
+ if e.errno == NO_SUCH_FILE_OR_DIRECTORY:
+ print("It looks like rustup is not installed. See instructions at "
+ "https://github.com/servo/servo/#setting-up-your-environment")
+ print()
+ return 1
+ raise
+ version = tuple(map(int, re.match(b"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups()))
+ if version < (1, 11, 0):
+ print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version)
+ print("Try running 'rustup self update'.")
+ return 1
+
def ensure_clobbered(self, target_dir=None):
if target_dir is None:
target_dir = self.get_target_dir()