Skip to content

Commit 2370a12

Browse files
committed
only for X86_64
1 parent 1e39921 commit 2370a12

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

mypyc/build_setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
import platform
23

34
try:
45
# Import setuptools so that it monkey-patch overrides distutils
@@ -29,12 +30,13 @@
2930

3031
ccompiler.CCompiler.__spawn = ccompiler.CCompiler.spawn # type: ignore[attr-defined]
3132

33+
X86_64 = platform.machine() in ("x86_64", "AMD64", "amd64")
3234

3335
def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
3436
compiler_type: str = self.compiler_type
3537
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT[compiler_type]
3638
new_cmd = list(cmd)
37-
if extra_options is not None:
39+
if X86_64 and extra_options is not None:
3840
# filenames are closer to the end of command line
3941
for argument in reversed(new_cmd):
4042
# Check if argument contains a filename. We must check for all

mypyc/lib-rt/setup.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
import subprocess
1010
import sys
11-
from collections.abc import Iterable
11+
import platform
1212
from distutils import ccompiler, sysconfig
1313
from typing import Any
1414

@@ -40,19 +40,20 @@
4040
},
4141
}
4242

43-
__spawn = ccompiler.CCompiler.spawn
43+
ccompiler.CCompiler.__spawn = ccompiler.CCompiler.spawn # type: ignore[attr-defined]
4444

45+
X86_64 = platform.machine() in ("x86_64", "AMD64", "amd64")
4546

46-
def spawn(self: ccompiler.CCompiler, cmd: Iterable[str], **kwargs: Any) -> None:
47-
compiler_type: str = self.compiler_type # type: ignore[attr-defined]
47+
def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
48+
compiler_type: str = self.compiler_type
4849
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT[compiler_type]
4950
new_cmd = list(cmd)
50-
if extra_options is not None:
51+
if X86_64 and extra_options is not None:
5152
# filenames are closer to the end of command line
5253
for argument in reversed(new_cmd):
5354
# Check if argument contains a filename. We must check for all
5455
# possible extensions; checking for target extension is faster.
55-
if self.obj_extension and not str(argument).endswith(self.obj_extension): # type: ignore[attr-defined]
56+
if self.obj_extension and not str(argument).endswith(self.obj_extension):
5657
continue
5758

5859
for path in extra_options.keys():
@@ -66,12 +67,10 @@ def spawn(self: ccompiler.CCompiler, cmd: Iterable[str], **kwargs: Any) -> None:
6667

6768
# path component is found, no need to search any further
6869
break
69-
__spawn(self, new_cmd, **kwargs)
70+
self.__spawn(new_cmd, **kwargs)
7071

7172

7273
ccompiler.CCompiler.spawn = spawn # type: ignore[method-assign]
73-
74-
7574
class BuildExtGtest(build_ext):
7675
def get_library_names(self) -> list[str]:
7776
return ["gtest"]

0 commit comments

Comments
 (0)