File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed
create/via_global_ref/builtin/cpython Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change
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 10
10
from six import add_metaclass
11
11
12
12
from virtualenv .create .via_global_ref .builtin .ref import ExePathRefToDest , PathRefToDest , RefMust
13
+ from virtualenv .info import IS_MAC_ARM64
13
14
from virtualenv .util .path import Path
14
15
from virtualenv .util .six import ensure_text
15
16
@@ -102,6 +103,13 @@ def reload_code(self):
102
103
)
103
104
return result
104
105
106
+ @classmethod
107
+ def can_create (cls , interpreter ):
108
+ if IS_MAC_ARM64 :
109
+ return False
110
+ else :
111
+ return super (CPythonmacOsFramework , cls ).can_create (interpreter )
112
+
105
113
106
114
class CPython3macOsFramework (CPythonmacOsFramework , CPython3 , CPythonPosix ):
107
115
@classmethod
Original file line number Diff line number Diff line change 12
12
PY3 = sys .version_info [0 ] == 3
13
13
PY2 = sys .version_info [0 ] == 2
14
14
IS_WIN = sys .platform == "win32"
15
+ IS_MAC_ARM64 = sys .platform == "darwin" and platform .machine () == "arm64"
15
16
ROOT = os .path .realpath (os .path .join (os .path .abspath (__file__ ), os .path .pardir , os .path .pardir ))
16
17
IS_ZIPAPP = os .path .isfile (ROOT )
17
18
WIN_CPYTHON_2 = IS_CPYTHON and IS_WIN and PY2
You can’t perform that action at this time.
0 commit comments