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 <moiein2000@gmail.com>

Co-authored-by: matham <moiein2000@gmail.com>
This commit is contained in:
Gabriel Pettier 2021-01-23 03:17:45 +01:00 committed by GitHub
parent 41ddf31690
commit 72f2144882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -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