From 4d32321f3439f909ade6d0a12c6de9a75bea0d16 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 4 Dec 2021 11:12:08 +0000 Subject: [PATCH] Ignore rmtree errors on Windows during cleanup This fails our CI occasionally, but we don't really care about the occasional file escaping deletion - this is more about hygene than anything else, so ignore errors on this step. --- cibuildwheel/windows.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 77c41cd6..c6749790 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -449,7 +449,9 @@ def build(options: Options) -> None: shell(test_command_prepared, cwd="c:\\", env=virtualenv_env) # clean up - shutil.rmtree(venv_dir) + # (we ignore errors because occasionally Windows fails to unlink a file and we + # don't want to abort a build because of that) + shutil.rmtree(venv_dir, ignore_errors=True) # we're all done here; move it to output (remove if already exists) shutil.move(str(repaired_wheel), build_options.output_dir)