[Python-checkins] r74798 - python/trunk/setup.py

ronald.oussoren python-checkins at python.org
Tue Sep 15 20:33:38 CEST 2009


Author: ronald.oussoren
Date: Tue Sep 15 20:33:33 2009
New Revision: 74798

Log:
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.


Modified:
   python/trunk/setup.py

Modified: python/trunk/setup.py
==============================================================================
--- python/trunk/setup.py	(original)
+++ python/trunk/setup.py	Tue Sep 15 20:33:33 2009
@@ -1499,19 +1499,17 @@
         # architectures.
         cflags = sysconfig.get_config_vars('CFLAGS')[0]
         archs = re.findall('-arch\s+(\w+)', cflags)
-        if 'x86_64' in archs or 'ppc64' in archs:
-            try:
-                archs.remove('x86_64')
-            except ValueError:
-                pass
-            try:
-                archs.remove('ppc64')
-            except ValueError:
-                pass
-
-            for a in archs:
-                frameworks.append('-arch')
-                frameworks.append(a)
+        fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(F,))
+        detected_archs = []
+        for ln in fp:
+            a = ln.split()[-1]
+            if a in archs:
+                detected_archs.append(ln.split()[-1])
+        fp.close()
+
+        for a in detected_archs:
+            frameworks.append('-arch')
+            frameworks.append(a)
 
         ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
                         define_macros=[('WITH_APPINIT', 1)],


More information about the Python-checkins mailing list