Revert "Use rustup "proxies" instead of rustup run"

This reverts commit ad22368646290510149d33a0a41fc436ac4a0e96.
This commit is contained in:
Simon Sapin 2017-12-19 17:44:22 +01:00
parent 2618e4ed9d
commit ded0bc9365

View file

@ -14,6 +14,7 @@ import itertools
import locale import locale
import os import os
from os import path from os import path
import re
import contextlib import contextlib
import subprocess import subprocess
from subprocess import PIPE from subprocess import PIPE
@ -136,8 +137,7 @@ def call(*args, **kwargs):
kwargs['env'] = normalize_env(kwargs['env']) kwargs['env'] = normalize_env(kwargs['env'])
# we have to use shell=True in order to get PATH handling # we have to use shell=True in order to get PATH handling
# when looking for the binary on Windows # when looking for the binary on Windows
kwargs.setdefault("shell", sys.platform == "win32") return subprocess.call(*args, shell=sys.platform == 'win32', **kwargs)
return subprocess.call(*args, **kwargs)
def check_output(*args, **kwargs): def check_output(*args, **kwargs):
@ -149,8 +149,7 @@ def check_output(*args, **kwargs):
kwargs['env'] = normalize_env(kwargs['env']) kwargs['env'] = normalize_env(kwargs['env'])
# we have to use shell=True in order to get PATH handling # we have to use shell=True in order to get PATH handling
# when looking for the binary on Windows # when looking for the binary on Windows
kwargs.setdefault("shell", sys.platform == "win32") return subprocess.check_output(*args, shell=sys.platform == 'win32', **kwargs)
return subprocess.check_output(*args, **kwargs)
def check_call(*args, **kwargs): def check_call(*args, **kwargs):
@ -166,8 +165,7 @@ def check_call(*args, **kwargs):
print(' '.join(args[0])) print(' '.join(args[0]))
# we have to use shell=True in order to get PATH handling # we have to use shell=True in order to get PATH handling
# when looking for the binary on Windows # when looking for the binary on Windows
kwargs.setdefault("shell", sys.platform == "win32") proc = subprocess.Popen(*args, shell=sys.platform == 'win32', **kwargs)
proc = subprocess.Popen(*args, **kwargs)
status = None status = None
# Leave it to the subprocess to handle Ctrl+C. If it terminates as # 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, # a result of Ctrl+C, proc.wait() will return a status code, and,
@ -324,21 +322,24 @@ class CommandBase(object):
return self._default_toolchain return self._default_toolchain
def call_rustup_run(self, args, **kwargs): def call_rustup_run(self, args, **kwargs):
args[0] += BIN_SUFFIX
if self.config["tools"]["use-rustup"]: if self.config["tools"]["use-rustup"]:
try: try:
kwargs.setdefault("env", {})["RUSTUP_TOOLCHAIN"] = self.toolchain() version_line = subprocess.check_output(["rustup" + BIN_SUFFIX, "--version"])
return call(args, executable="rustup" + BIN_SUFFIX, shell=False, **kwargs)
except OSError as e: except OSError as e:
if e.errno == NO_SUCH_FILE_OR_DIRECTORY: if e.errno == NO_SUCH_FILE_OR_DIRECTORY:
print repr(e)
print
print "It looks like rustup is not installed. See instructions at " \ print "It looks like rustup is not installed. See instructions at " \
"https://github.com/servo/servo/#setting-up-your-environment" "https://github.com/servo/servo/#setting-up-your-environment"
print print
return 1 return 1
raise 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: else:
args[0] += BIN_SUFFIX
return call(args, **kwargs) return call(args, **kwargs)
def get_top_dir(self): def get_top_dir(self):