From 72f21448828ef06d00365794b4b1bc811d248aab Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Sat, 23 Jan 2021 03:17:45 +0100 Subject: [PATCH] OSX: Use platform.machine() for osx version detection (#7341) * try to directly use platform.machine() for osx version detection * Update setup.py Co-authored-by: matham Co-authored-by: matham --- setup.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 907d6d297..9a507c6c4 100644 --- a/setup.py +++ b/setup.py @@ -103,12 +103,9 @@ build_examples = build_examples or \ platform = sys.platform -# Detect 32/64bit for OSX (http://stackoverflow.com/a/1405971/798575) if sys.platform == 'darwin': - if sys.maxsize > 2 ** 32: - osx_arch = 'x86_64' - else: - osx_arch = 'i386' + from platform import machine + osx_arch = machine() # Detect Python for android project (http://github.com/kivy/python-for-android) @@ -427,8 +424,8 @@ elif platform == 'darwin': if osx_arch == "i386": print("Warning: building with frameworks fail on i386") else: - print("OSX framework used, force to x86_64 only") - environ["ARCHFLAGS"] = environ.get("ARCHFLAGS", "-arch x86_64") + print(f"OSX framework used, force to {osx_arch} only") + environ["ARCHFLAGS"] = environ.get("ARCHFLAGS", f"-arch {osx_arch}") print("OSX ARCHFLAGS are: {}".format(environ["ARCHFLAGS"])) # detect gstreamer, only on desktop