mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
Auto merge of #10620 - autrilla:mach-command-improvements, r=Wafflespeanut
Improved readability of ensure_bootstrapped <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10620) <!-- Reviewable:end -->
This commit is contained in:
commit
a87fa103b8
1 changed files with 19 additions and 11 deletions
|
@ -415,18 +415,26 @@ class CommandBase(object):
|
||||||
if self.context.bootstrapped:
|
if self.context.bootstrapped:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.config["tools"]["system-rust"] and \
|
rust_root = self.config["tools"]["rust-root"]
|
||||||
(not path.exists(path.join(
|
rustc_path = path.join(
|
||||||
self.config["tools"]["rust-root"], "rustc", "bin", "rustc" + BIN_SUFFIX)) or
|
rust_root, "rustc", "bin", "rustc" + BIN_SUFFIX
|
||||||
not all([path.exists(path.join(
|
)
|
||||||
self.config["tools"]["rust-root"], "rustc", "lib", "rustlib", x
|
rustc_binary_exists = path.exists(rustc_path)
|
||||||
)) for x in targets])):
|
|
||||||
print("looking for rustc at %s" % path.join(
|
base_target_path = path.join(rust_root, "rustc", "lib", "rustlib")
|
||||||
self.config["tools"]["rust-root"], "rustc", "bin", "rustc" + BIN_SUFFIX))
|
target_paths = [path.join(base_target_path, t) for t in targets]
|
||||||
|
all_targets_exist = all([path.exists(p) for p in target_paths])
|
||||||
|
|
||||||
|
if (not self.config['tools']['system-rust'] and
|
||||||
|
(not rustc_binary_exists or not all_targets_exist)):
|
||||||
|
print("looking for rustc at %s" % (rustc_path))
|
||||||
Registrar.dispatch("bootstrap-rust", context=self.context, target=targets)
|
Registrar.dispatch("bootstrap-rust", context=self.context, target=targets)
|
||||||
if not self.config["tools"]["system-cargo"] and \
|
|
||||||
not path.exists(path.join(
|
cargo_path = path.join(self.config["tools"]["cargo-root"], "cargo", "bin",
|
||||||
self.config["tools"]["cargo-root"], "cargo", "bin", "cargo" + BIN_SUFFIX)):
|
"cargo" + BIN_SUFFIX)
|
||||||
|
cargo_binary_exists = path.exists(cargo_path)
|
||||||
|
|
||||||
|
if not self.config["tools"]["system-cargo"] and not cargo_binary_exists:
|
||||||
Registrar.dispatch("bootstrap-cargo", context=self.context)
|
Registrar.dispatch("bootstrap-cargo", context=self.context)
|
||||||
|
|
||||||
self.context.bootstrapped = True
|
self.context.bootstrapped = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue