diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-12-19 17:44:22 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2018-01-10 18:05:45 +0100 |
commit | ded0bc93653dabd23c9fd4f2db17caa1074af841 (patch) | |
tree | 7eff94873c15a6894d8d8dbdf85d5d5b9302048b /python/servo/command_base.py | |
parent | 2618e4ed9d15d75efb21802dfbd0788127b63e11 (diff) | |
download | servo-ded0bc93653dabd23c9fd4f2db17caa1074af841.tar.gz servo-ded0bc93653dabd23c9fd4f2db17caa1074af841.zip |
Revert "Use rustup "proxies" instead of `rustup run`"
This reverts commit ad22368646290510149d33a0a41fc436ac4a0e96.
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index dd1f6fdc885..c7d6f51d1f9 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -14,6 +14,7 @@ import itertools import locale import os from os import path +import re import contextlib import subprocess from subprocess import PIPE @@ -136,8 +137,7 @@ def call(*args, **kwargs): kwargs['env'] = normalize_env(kwargs['env']) # we have to use shell=True in order to get PATH handling # when looking for the binary on Windows - kwargs.setdefault("shell", sys.platform == "win32") - return subprocess.call(*args, **kwargs) + return subprocess.call(*args, shell=sys.platform == 'win32', **kwargs) def check_output(*args, **kwargs): @@ -149,8 +149,7 @@ def check_output(*args, **kwargs): kwargs['env'] = normalize_env(kwargs['env']) # we have to use shell=True in order to get PATH handling # when looking for the binary on Windows - kwargs.setdefault("shell", sys.platform == "win32") - return subprocess.check_output(*args, **kwargs) + return subprocess.check_output(*args, shell=sys.platform == 'win32', **kwargs) def check_call(*args, **kwargs): @@ -166,8 +165,7 @@ def check_call(*args, **kwargs): print(' '.join(args[0])) # we have to use shell=True in order to get PATH handling # when looking for the binary on Windows - kwargs.setdefault("shell", sys.platform == "win32") - proc = subprocess.Popen(*args, **kwargs) + proc = subprocess.Popen(*args, shell=sys.platform == 'win32', **kwargs) status = None # Leave it to the subprocess to handle Ctrl+C. If it terminates as # a result of Ctrl+C, proc.wait() will return a status code, and, @@ -324,22 +322,25 @@ class CommandBase(object): return self._default_toolchain def call_rustup_run(self, args, **kwargs): - args[0] += BIN_SUFFIX if self.config["tools"]["use-rustup"]: try: - kwargs.setdefault("env", {})["RUSTUP_TOOLCHAIN"] = self.toolchain() - return call(args, executable="rustup" + BIN_SUFFIX, shell=False, **kwargs) + version_line = subprocess.check_output(["rustup" + BIN_SUFFIX, "--version"]) except OSError as e: if e.errno == NO_SUCH_FILE_OR_DIRECTORY: - print repr(e) - print 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("rustup (\d+)\.(\d+)\.(\d+)", version_line).groups())) + if version < (1, 8, 0): + print "rustup is at version %s.%s.%s, Servo requires 1.8.0 or more recent." % version + print "Try running 'rustup self update'." + return 1 + args = ["rustup" + BIN_SUFFIX, "run", "--install", self.toolchain()] + args else: - return call(args, **kwargs) + args[0] += BIN_SUFFIX + return call(args, **kwargs) def get_top_dir(self): return self.context.topdir |