From d53e06d1f4f82181a405277db239135140f443bf Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Tue, 15 May 2018 20:14:52 +0200 Subject: Don't try to list files in directories that don't exist Fixes #20784 --- python/servo/bootstrap_commands.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'python/servo/bootstrap_commands.py') diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 1d103fe5aca..f732b97c59b 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -237,8 +237,14 @@ class MachCommands(CommandBase): git_dir = path.join(cargo_dir, "git") git_db_dir = path.join(git_dir, "db") git_checkout_dir = path.join(git_dir, "checkouts") - git_db_list = filter(lambda f: not f.startswith('.'), os.listdir(git_db_dir)) - git_checkout_list = os.listdir(git_checkout_dir) + if os.path.isdir(git_db_dir): + git_db_list = filter(lambda f: not f.startswith('.'), os.listdir(git_db_dir)) + else: + git_db_list = [] + if os.path.isdir(git_checkout_dir): + git_checkout_list = os.listdir(git_checkout_dir) + else: + git_checkout_list = [] for d in list(set(git_db_list + git_checkout_list)): crate_name = d.replace("-{}".format(d.split("-")[-1]), "") -- cgit v1.2.3