Skip to content

Commit

Permalink
fix: Correctly remove bk dir when re-signing macOS Python 2.x executable
Browse files Browse the repository at this point in the history
Fixes #2271

> PermissionError: [Errno 1] Operation not permitted:
'/Users/alex/src/virtualenv/v27/bin/bk'

Requires #2270
Refs #2233
  • Loading branch information
moreati committed Dec 31, 2021
1 parent d8cc529 commit c3e4986
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changelog/bugfix.2271.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix ``PermissionError: [Errno 1] Operation not permitted`` when creating a
Python 2.x virtualenv on macOS/arm64 - by ``moreati``
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def fix_signature(self):
bak_dir.mkdir(parents=True, exist_ok=True)
subprocess.check_call(["cp", exe, bak_dir])
subprocess.check_call(["mv", bak_dir / exe.name, exe])
bak_dir.unlink()
bak_dir.rmdir()
cmd = ["codesign", "-s", "-", "--preserve-metadata=identifier,entitlements,flags,runtime", "-f", exe]
logging.debug("Changing Signature: %s", cmd)
subprocess.check_call(cmd)
Expand Down

0 comments on commit c3e4986

Please sign in to comment.