diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index c9167d7638a..0ab5253ee72 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -33,11 +33,14 @@ def get(url, path, verbose=False): print("moving " + temp_path + " to " + path) shutil.move(temp_path, path) finally: - print("removing " + sha_path) - os.unlink(sha_path) - if os.path.isfile(temp_path): - print("removing " + temp_path) - os.unlink(temp_path) + delete_if_present(sha_path) + delete_if_present(temp_path) + + +def delete_if_present(path): + if os.path.isfile(path): + print("removing " + path) + os.unlink(path) def download(path, url, verbose):