Skip to content

Commit 33bf863

Browse files
Only add extra arguments when using macOS universal builds.
1 parent 0913f8f commit 33bf863

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import os
2626
import platform
2727
import sys
28+
import sysconfig
2829
from setuptools import setup, Extension
2930

3031
# base source directory
@@ -61,11 +62,10 @@
6162
thin_depends.append(base_pxd)
6263

6364
# if the platform is macOS, add arguments required for cross-compilation for
64-
# both x86_64 and arm64 architectures.
65-
# Use a Universal 2 Python binary to build, or set an archtecture
66-
# before building, e.g. export ARCHFLAGS="-arch x86_64"
65+
# both x86_64 and arm64 architectures if the python interpreter is a
66+
# universal2 version.
6767
extra_compile_args = []
68-
if sys.platform == "darwin":
68+
if sys.platform == "darwin" and "universal2" in sysconfig.get_platform():
6969
if platform.machine() == "x86_64":
7070
target = "arm64-apple-macos"
7171
else:

0 commit comments

Comments
 (0)