about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCyryl Płotnicki-Chudyk <cyplo@cyplo.net>2016-05-08 10:00:36 +0200
committerCyryl Płotnicki-Chudyk <cyplo@cyplo.net>2016-05-08 10:00:36 +0200
commit6bce110c3e6a931fe1bd79c640e9d29a744f0e8f (patch)
treefe550fa1d808db75eee50818c1dc53c00157e35c
parent15de207b9c79c603aa10c30ae54ca07b295aadaf (diff)
downloadrust-6bce110c3e6a931fe1bd79c640e9d29a744f0e8f.tar.gz
rust-6bce110c3e6a931fe1bd79c640e9d29a744f0e8f.zip
Remove sha256 file only if present.
-rw-r--r--src/bootstrap/bootstrap.py13
1 files changed, 8 insertions, 5 deletions
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):