Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cast type from Path to text #2288

Merged
merged 6 commits into from Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/2282.bugfix.rst
@@ -0,0 +1 @@
fix "execv() arg 2 must contain only strings" error on M1 MacOS
15 changes: 11 additions & 4 deletions src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py
Expand Up @@ -7,7 +7,7 @@
from abc import ABCMeta, abstractmethod
from textwrap import dedent

from six import add_metaclass
from six import add_metaclass, text_type

from virtualenv.create.via_global_ref.builtin.ref import ExePathRefToDest, PathRefToDest, RefMust
from virtualenv.info import IS_MAC_ARM64
Expand Down Expand Up @@ -134,10 +134,17 @@ def fix_signature(self):
# Reset the signing on Darwin since the exe has been modified.
# Note codesign fails on the original exe, it needs to be copied and moved back.
bak_dir.mkdir(parents=True, exist_ok=True)
subprocess.check_call(["cp", exe, bak_dir])
subprocess.check_call(["mv", bak_dir / exe.name, exe])
subprocess.check_call(["cp", text_type(exe), text_type(bak_dir)])
subprocess.check_call(["mv", text_type(bak_dir / exe.name), text_type(exe)])
bak_dir.rmdir()
cmd = ["codesign", "-s", "-", "--preserve-metadata=identifier,entitlements,flags,runtime", "-f", exe]
cmd = [
"codesign",
"-s",
"-",
"--preserve-metadata=identifier,entitlements,flags,runtime",
"-f",
text_type(exe),
]
logging.debug("Changing Signature: %s", cmd)
subprocess.check_call(cmd)
except Exception:
Expand Down