diff options
author | Josh Matthews <josh@joshmatthews.net> | 2018-08-01 20:52:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 20:52:17 -0400 |
commit | 458879b2cd1cf20b3e166649b8b0cb8df72a2389 (patch) | |
tree | 56ec103a31e889633d46a35c5c1a02a0b7b5f86d /python/servo/bootstrap_commands.py | |
parent | 451c52e18d93f6b97a3c9e7f6a1da6daad1a36f3 (diff) | |
download | servo-458879b2cd1cf20b3e166649b8b0cb8df72a2389.tar.gz servo-458879b2cd1cf20b3e166649b8b0cb8df72a2389.zip |
mach: Avoid python error when there's no cargo cache.
Diffstat (limited to 'python/servo/bootstrap_commands.py')
-rw-r--r-- | python/servo/bootstrap_commands.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 481a6f174e1..6660770677b 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -366,14 +366,15 @@ class MachCommands(CommandBase): elif os.path.isdir(path.join(git_db_dir, d)): packages["git"][crate_name]["exist"].append(("del", d, "")) - for d in os.listdir(crates_src_dir): - crate_name = re.sub(r"\-\d+(\.\d+){1,3}.+", "", d) - if not packages["crates"].get(crate_name, False): - packages["crates"][crate_name] = { - "current": [], - "exist": [], - } - packages["crates"][crate_name]["exist"].append(d) + if crates_src_dir: + for d in os.listdir(crates_src_dir): + crate_name = re.sub(r"\-\d+(\.\d+){1,3}.+", "", d) + if not packages["crates"].get(crate_name, False): + packages["crates"][crate_name] = { + "current": [], + "exist": [], + } + packages["crates"][crate_name]["exist"].append(d) total_size = 0 for packages_type in ["git", "crates"]: |