From 458879b2cd1cf20b3e166649b8b0cb8df72a2389 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 1 Aug 2018 20:52:17 -0400 Subject: mach: Avoid python error when there's no cargo cache. --- python/servo/bootstrap_commands.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'python/servo/bootstrap_commands.py') 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"]: -- cgit v1.2.3