From 4201c17edd9e03b926cdb2bff5b364316fef0bab Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Fri, 10 Apr 2026 18:30:33 -0700 Subject: [PATCH] fix: handle read-only files on Windows when removing crosspoint-reader directory --- install.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/install.py b/install.py index ab6c8ca..216aa20 100644 --- a/install.py +++ b/install.py @@ -25,11 +25,23 @@ def run(cmd, cwd=None, check=True): return subprocess.run(cmd, shell=True, cwd=cwd, check=check) +def remove_readonly(func, path, _): + os.chmod(path, 0o777) + func(path) + + +def rmtree(path): + if sys.version_info >= (3, 12): + shutil.rmtree(path, onexc=remove_readonly) + else: + shutil.rmtree(path, onerror=remove_readonly) + + def clone_repo(): print("[1/3] Cloning CrossPoint repository...") if os.path.exists(REPO_DIR): print(f" Removing existing '{REPO_DIR}'...") - shutil.rmtree(REPO_DIR) + rmtree(REPO_DIR) run(f"git clone --recursive {REPO_URL} {REPO_DIR}")