diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-09-15 19:11:53 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-09-15 19:11:53 (GMT) |
commit | 38a4d8cec24136fd4ba2fec3b0e50ea77ec938fd (patch) | |
tree | 302e6109a73065fc0d5ab8b3068806a6334b276d /setup.py | |
parent | 61c34d8c09c400f2471f6232d3e1094f48b64bfc (diff) | |
download | cpython-38a4d8cec24136fd4ba2fec3b0e50ea77ec938fd.zip cpython-38a4d8cec24136fd4ba2fec3b0e50ea77ec938fd.tar.gz cpython-38a4d8cec24136fd4ba2fec3b0e50ea77ec938fd.tar.bz2 |
Merged revisions 74804 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r74804 | ronald.oussoren | 2009-09-15 21:07:58 +0200 (Tue, 15 Sep 2009) | 15 lines
Merged revisions 74798 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74798 | ronald.oussoren | 2009-09-15 20:33:33 +0200 (Tue, 15 Sep 2009) | 8 lines
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.
........
................
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -1272,19 +1272,26 @@ class PyBuildExt(build_ext): # 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) + tmpfile = os.path.join(self.build_temp, 'tk.arch') + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) + + # Note: cannot use os.popen or subprocess here, that + # requires extensions that are not available here. + os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile)) + fp = open(tmpfile) + detected_archs = [] + for ln in fp: + a = ln.split()[-1] + if a in archs: + detected_archs.append(ln.split()[-1]) + fp.close() + os.unlink(tmpfile) + + for a in detected_archs: + frameworks.append('-arch') + frameworks.append(a) ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], define_macros=[('WITH_APPINIT', 1)], |