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

Fail early instead of creating non-working env #2189

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/2189.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fail early instead of creating a non-working env for Python 2 on Apple Silicon (M1) Macs.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from six import add_metaclass

from virtualenv.create.via_global_ref.builtin.ref import ExePathRefToDest, PathRefToDest, RefMust
from virtualenv.info import IS_MAC_ARM64
from virtualenv.util.path import Path
from virtualenv.util.six import ensure_text

Expand Down Expand Up @@ -102,6 +103,13 @@ def reload_code(self):
)
return result

@classmethod
def can_create(cls, interpreter):
if IS_MAC_ARM64:
return False
else:
return super(CPythonmacOsFramework, cls).can_create(interpreter)


class CPython3macOsFramework(CPythonmacOsFramework, CPython3, CPythonPosix):
@classmethod
Expand Down
1 change: 1 addition & 0 deletions src/virtualenv/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
PY3 = sys.version_info[0] == 3
PY2 = sys.version_info[0] == 2
IS_WIN = sys.platform == "win32"
IS_MAC_ARM64 = sys.platform == "darwin" and platform.machine() == "arm64"
ROOT = os.path.realpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir))
IS_ZIPAPP = os.path.isfile(ROOT)
WIN_CPYTHON_2 = IS_CPYTHON and IS_WIN and PY2
Expand Down