aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorAdrian Utrilla <adrianutrilla@gmail.com>2016-04-15 00:24:41 +0200
committerAdrian Utrilla <adrianutrilla@gmail.com>2016-04-16 11:55:20 +0200
commitec583326994010195e0a3afa065cd922c948b890 (patch)
tree0544b037f96b25b1732def1e381c96e90b9db451 /python/servo/command_base.py
parentdb4481b4509db4be83e0f77a66884feccd1878e0 (diff)
downloadservo-ec583326994010195e0a3afa065cd922c948b890.tar.gz
servo-ec583326994010195e0a3afa065cd922c948b890.zip
Improved readability of ensure_bootstrapped
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index cf25bc41927..a79792ada03 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -405,18 +405,26 @@ class CommandBase(object):
if self.context.bootstrapped:
return
- if not self.config["tools"]["system-rust"] and \
- (not path.exists(path.join(
- self.config["tools"]["rust-root"], "rustc", "bin", "rustc" + BIN_SUFFIX)) or
- not all([path.exists(path.join(
- self.config["tools"]["rust-root"], "rustc", "lib", "rustlib", x
- )) for x in targets])):
- print("looking for rustc at %s" % path.join(
- self.config["tools"]["rust-root"], "rustc", "bin", "rustc" + BIN_SUFFIX))
+ rust_root = self.config["tools"]["rust-root"]
+ rustc_path = path.join(
+ rust_root, "rustc", "bin", "rustc" + BIN_SUFFIX
+ )
+ rustc_binary_exists = path.exists(rustc_path)
+
+ base_target_path = path.join(rust_root, "rustc", "lib", "rustlib")
+ 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)
- if not self.config["tools"]["system-cargo"] and \
- not path.exists(path.join(
- self.config["tools"]["cargo-root"], "cargo", "bin", "cargo" + BIN_SUFFIX)):
+
+ cargo_path = path.join(self.config["tools"]["cargo-root"], "cargo", "bin",
+ "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)
self.context.bootstrapped = True