From d654998ea2b0690efcd14930633db8c79ce2b0e2 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Wed, 2 Mar 2016 18:24:30 +0100 Subject: [PATCH] Do not try to remove non-existing directories Fixes the following error ``` Traceback (most recent call last): File ".../src/bootstrap/bootstrap.py", line 303, in rb.download_rust_nightly() File ".../src/bootstrap/bootstrap.py", line 76, in download_rust_nightly shutil.rmtree(self.bin_root()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 239, in rmtree onerror(os.listdir, path, sys.exc_info()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 237, in rmtree names = os.listdir(path) OSError: [Errno 2] No such file or directory: '.../build/x86_64-apple-darwin/stage0' make: *** [all] Error 1 ``` which occurs when a rustbuild is started on a clean repository. --- src/bootstrap/bootstrap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 6659894a171f0..5de7e6957c6f1 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -73,7 +73,8 @@ def download_rust_nightly(self): if self.rustc().startswith(self.bin_root()) and \ (not os.path.exists(self.rustc()) or self.rustc_out_of_date()): - shutil.rmtree(self.bin_root()) + if os.path.exists(self.bin_root()): + shutil.rmtree(self.bin_root()) filename = "rust-std-nightly-" + self.build + ".tar.gz" url = "https://static.rust-lang.org/dist/" + self.snap_rustc_date() tarball = os.path.join(rustc_cache, filename)