From ce5d9bc819ff217d681c6edd2266daf5fad2b8f6 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 11 May 2016 11:11:16 -0700 Subject: [PATCH] Override $CARGO_HOME only if cargo-home-dir is in .servobuild This preserved the fix from #11097 in the situation where `$CARGO_HOME` and `cargo-home-dir` in `.servobuild` are both present: `.servobuild` should win. But it changes the behavior when `$CARGO_HOME` is present and `.servobuild` is not: Then `$CARGO_HOME` should be used. We now check the following values in order of priority and use the first one that is found: 1. `cargo-home-dir` in `.servobuild` 2. `CARGO_HOME_DIR` in the enivironment 3. default value (`/.cargo`) --- python/servo/command_base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 0b51bf93dc6..492aefda254 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -149,8 +149,9 @@ class CommandBase(object): self.config["tools"].setdefault("cache-dir", default_cache_dir) resolverelative("tools", "cache-dir") - self.config["tools"].setdefault("cargo-home-dir", - path.join(context.topdir, ".cargo")) + default_cargo_home = os.environ.get("CARGO_HOME", + path.join(context.topdir, ".cargo")) + self.config["tools"].setdefault("cargo-home-dir", default_cargo_home) resolverelative("tools", "cargo-home-dir") context.sharedir = self.config["tools"]["cache-dir"]