From 4e9df8e8f6f15b1eae37e8998fbd428bd8228d5d Mon Sep 17 00:00:00 2001 From: Isac Byeonghoon Yoo Date: Wed, 19 Jan 2022 23:11:05 +0900 Subject: [PATCH 1/6] fix: cast type from Path to text --- .../via_global_ref/builtin/cpython/mac_os.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py index 5e06de2be..cb9817808 100644 --- a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py +++ b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py @@ -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 @@ -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: From 82c18534c336e07f0318eaed8bcc7dae941fdf85 Mon Sep 17 00:00:00 2001 From: Isac Byeonghoon Yoo Date: Wed, 19 Jan 2022 23:19:56 +0900 Subject: [PATCH 2/6] Add changelog --- docs/changelog/2282.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changelog/2282.bugfix.rst diff --git a/docs/changelog/2282.bugfix.rst b/docs/changelog/2282.bugfix.rst new file mode 100644 index 000000000..303dc167c --- /dev/null +++ b/docs/changelog/2282.bugfix.rst @@ -0,0 +1 @@ ++ fix `execv() arg 2 must contain only strings` error on M1 MacOS \ No newline at end of file From da3b42caa3584805147483fb3e219dba55dfdc0e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Jan 2022 14:20:20 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/changelog/2282.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/2282.bugfix.rst b/docs/changelog/2282.bugfix.rst index 303dc167c..469e45edf 100644 --- a/docs/changelog/2282.bugfix.rst +++ b/docs/changelog/2282.bugfix.rst @@ -1 +1 @@ -+ fix `execv() arg 2 must contain only strings` error on M1 MacOS \ No newline at end of file ++ fix `execv() arg 2 must contain only strings` error on M1 MacOS From 679954329e7a436838f2aac7b03aa622a75c5fbc Mon Sep 17 00:00:00 2001 From: Isac Byeonghoon Yoo Date: Wed, 19 Jan 2022 23:21:06 +0900 Subject: [PATCH 4/6] fix typo --- docs/changelog/2282.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/2282.bugfix.rst b/docs/changelog/2282.bugfix.rst index 469e45edf..64646c150 100644 --- a/docs/changelog/2282.bugfix.rst +++ b/docs/changelog/2282.bugfix.rst @@ -1 +1 @@ -+ fix `execv() arg 2 must contain only strings` error on M1 MacOS +fix `execv() arg 2 must contain only strings` error on M1 MacOS From b707e8e92ffaec2b3c33433f4ea3701401b36020 Mon Sep 17 00:00:00 2001 From: Isac Byeonghoon Yoo Date: Wed, 19 Jan 2022 23:22:04 +0900 Subject: [PATCH 5/6] fix lint --- docs/changelog/2282.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/2282.bugfix.rst b/docs/changelog/2282.bugfix.rst index 64646c150..0a9846d56 100644 --- a/docs/changelog/2282.bugfix.rst +++ b/docs/changelog/2282.bugfix.rst @@ -1 +1 @@ -fix `execv() arg 2 must contain only strings` error on M1 MacOS +fix "execv() arg 2 must contain only strings" error on M1 MacOS From f13477dde9942543f856d22b60f339aecc4553cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sat, 5 Feb 2022 11:33:45 +0000 Subject: [PATCH 6/6] PR Feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- .../create/via_global_ref/builtin/cpython/mac_os.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py index cb9817808..6024c97d1 100644 --- a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py +++ b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py @@ -137,14 +137,8 @@ def fix_signature(self): 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", - text_type(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: @@ -205,7 +199,7 @@ def fix_mach_o(exe, current, new, max_size): unneeded bits of information, however Mac OS X 10.5 and earlier cannot read this new Link Edit table format. """ try: - logging.debug(u"change Mach-O for %s from %s to %s", ensure_text(exe), current, ensure_text(new)) + logging.debug("change Mach-O for %s from %s to %s", ensure_text(exe), current, ensure_text(new)) _builtin_change_mach_o(max_size)(exe, current, new) except Exception as e: logging.warning("Could not call _builtin_change_mac_o: %s. " "Trying to call install_name_tool instead.", e)