mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
mach: check rustup version in ensure_bootstrapped()
This commit is contained in:
parent
d4da65d149
commit
855601ebb4
1 changed files with 20 additions and 16 deletions
|
@ -360,20 +360,7 @@ class CommandBase(object):
|
||||||
|
|
||||||
def call_rustup_run(self, args, **kwargs):
|
def call_rustup_run(self, args, **kwargs):
|
||||||
if self.config["tools"]["use-rustup"]:
|
if self.config["tools"]["use-rustup"]:
|
||||||
try:
|
self.ensure_rustup_version()
|
||||||
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
|
|
||||||
args = ["rustup" + BIN_SUFFIX, "run", "--install", self.rust_toolchain()] + args
|
args = ["rustup" + BIN_SUFFIX, "run", "--install", self.rust_toolchain()] + args
|
||||||
else:
|
else:
|
||||||
args[0] += BIN_SUFFIX
|
args[0] += BIN_SUFFIX
|
||||||
|
@ -1017,8 +1004,9 @@ install them, let us know by filing a bug!")
|
||||||
if "msvc" in target_platform:
|
if "msvc" in target_platform:
|
||||||
Registrar.dispatch("bootstrap", context=self.context)
|
Registrar.dispatch("bootstrap", context=self.context)
|
||||||
|
|
||||||
if target:
|
if self.config["tools"]["use-rustup"]:
|
||||||
if self.config["tools"]["use-rustup"] and not "uwp" in target:
|
self.ensure_rustup_version()
|
||||||
|
if target and "uwp" not in target:
|
||||||
# 'rustup target add' fails if the toolchain is not installed at all.
|
# 'rustup target add' fails if the toolchain is not installed at all.
|
||||||
self.call_rustup_run(["rustc", "--version"])
|
self.call_rustup_run(["rustc", "--version"])
|
||||||
|
|
||||||
|
@ -1028,6 +1016,22 @@ install them, let us know by filing a bug!")
|
||||||
|
|
||||||
self.context.bootstrapped = True
|
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):
|
def ensure_clobbered(self, target_dir=None):
|
||||||
if target_dir is None:
|
if target_dir is None:
|
||||||
target_dir = self.get_target_dir()
|
target_dir = self.get_target_dir()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue