From 2ee516fa7ca43a2bede2b97aa7dbd80709e4828f Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 5 Nov 2014 13:59:31 -0800 Subject: Automatically update cargo when necessary --- python/servo/command_base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'python/servo/command_base.py') diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 45c1b230eb2..d78c0e13a1c 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -74,7 +74,7 @@ class CommandBase(object): context.sharedir, "rust", *self.rust_snapshot_path().split("/")) if not self.config["tools"]["system-cargo"]: self.config["tools"]["cargo-root"] = path.join( - context.sharedir, "cargo") + context.sharedir, "cargo", self.cargo_build_id()) self.config.setdefault("build", {}) self.config["build"].setdefault("android", False) @@ -85,6 +85,7 @@ class CommandBase(object): self.config["android"].setdefault("toolchain", "") _rust_snapshot_path = None + _cargo_build_id = None def rust_snapshot_path(self): if self._rust_snapshot_path is None: @@ -93,6 +94,12 @@ class CommandBase(object): self._rust_snapshot_path = "%s-%s" % (snapshot_hash, host_triple()) return self._rust_snapshot_path + def cargo_build_id(self): + if self._cargo_build_id is None: + filename = path.join(self.context.topdir, "cargo-nightly-build") + self._cargo_build_id = open(filename).read().strip() + return self._cargo_build_id + def build_env(self): """Return an extended environment dictionary.""" env = os.environ.copy() -- cgit v1.2.3