Skip to content

Commit f969a91

Browse files
isac322pre-commit-ci[bot]gaborbernat
authored
fix: cast type from Path to text (#2288)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
1 parent 5dde2d8 commit f969a91

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

docs/changelog/2282.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix "execv() arg 2 must contain only strings" error on M1 MacOS

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from abc import ABCMeta, abstractmethod
88
from textwrap import dedent
99

10-
from six import add_metaclass
10+
from six import add_metaclass, text_type
1111

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

0 commit comments

Comments
 (0)