From bf0fb3fc68958e1749ac36eb4c3491e3f21540e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 16 Apr 2020 13:54:50 +0200 Subject: [PATCH] simplified read-only handling again --- scripts/run_cmake.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/scripts/run_cmake.py b/scripts/run_cmake.py index 5ca36cc..06a2f07 100755 --- a/scripts/run_cmake.py +++ b/scripts/run_cmake.py @@ -154,17 +154,8 @@ def secure_delete(path: str): return def del_rw(action, name, exc): - if not os.path.exists(name): - return - - for root, dirs, files in os.walk(name, topdown=False): - for name in files: - p = Path(os.path.join(root, name)) - p.chmod(stat.S_IWRITE) - if os.path.isdir(name): - shutil.rmtree(name) - else: - os.unlink(name) + os.chmod(name, stat.S_IWRITE) + os.unlink(name) shutil.rmtree(path, onerror=del_rw)