mirror of https://github.com/python/cpython
MacOSX: detect the architectures supported by
Tk.framework and build _tkinter only for those architectures. This replaces the hardcoded solution that is no longer valid now that 64-bit capable versions of Tk are available on OSX.
This commit is contained in:
parent
ea7120c7c1
commit
91a11a46c0
22
setup.py
22
setup.py
|
@ -1499,19 +1499,17 @@ class PyBuildExt(build_ext):
|
||||||
# architectures.
|
# architectures.
|
||||||
cflags = sysconfig.get_config_vars('CFLAGS')[0]
|
cflags = sysconfig.get_config_vars('CFLAGS')[0]
|
||||||
archs = re.findall('-arch\s+(\w+)', cflags)
|
archs = re.findall('-arch\s+(\w+)', cflags)
|
||||||
if 'x86_64' in archs or 'ppc64' in archs:
|
fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(F,))
|
||||||
try:
|
detected_archs = []
|
||||||
archs.remove('x86_64')
|
for ln in fp:
|
||||||
except ValueError:
|
a = ln.split()[-1]
|
||||||
pass
|
if a in archs:
|
||||||
try:
|
detected_archs.append(ln.split()[-1])
|
||||||
archs.remove('ppc64')
|
fp.close()
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
for a in archs:
|
for a in detected_archs:
|
||||||
frameworks.append('-arch')
|
frameworks.append('-arch')
|
||||||
frameworks.append(a)
|
frameworks.append(a)
|
||||||
|
|
||||||
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
|
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
|
||||||
define_macros=[('WITH_APPINIT', 1)],
|
define_macros=[('WITH_APPINIT', 1)],
|
||||||
|
|
Loading…
Reference in New Issue