Skip to content

Commit

Permalink
fix: cast type from Path to text (#2288)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
3 people committed Feb 5, 2022
1 parent 5dde2d8 commit f969a91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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
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,11 @@ 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]
metadata = "--preserve-metadata=identifier,entitlements,flags,runtime"
cmd = ["codesign", "-s", "-", metadata, "-f", text_type(exe)]
logging.debug("Changing Signature: %s", cmd)
subprocess.check_call(cmd)
except Exception:
Expand Down

0 comments on commit f969a91

Please sign in to comment.