Skip to content

Commit 856933e

Browse files
authored
fix: Correctly remove bk dir when re-signing macOS Python 2.x executable (#2272)
1 parent 50c5591 commit 856933e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/changelog/bugfix.2271.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``PermissionError: [Errno 1] Operation not permitted`` when creating a
2+
Python 2.x virtualenv on macOS/arm64 - by ``moreati``

src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def fix_signature(self):
136136
bak_dir.mkdir(parents=True, exist_ok=True)
137137
subprocess.check_call(["cp", exe, bak_dir])
138138
subprocess.check_call(["mv", bak_dir / exe.name, exe])
139-
bak_dir.unlink()
139+
bak_dir.rmdir()
140140
cmd = ["codesign", "-s", "-", "--preserve-metadata=identifier,entitlements,flags,runtime", "-f", exe]
141141
logging.debug("Changing Signature: %s", cmd)
142142
subprocess.check_call(cmd)

0 commit comments

Comments
 (0)