Finish support for --with-universal-archs=intel

and --with-universal-archs=3-way (issue6245)
This commit is contained in:
Ronald Oussoren 2009-09-15 19:13:15 +00:00
parent 038f38d3ac
commit 5d90029041
2 changed files with 26 additions and 6 deletions

View File

@ -1095,7 +1095,10 @@ other utility module.
the univeral binary status instead of the architecture of the current the univeral binary status instead of the architecture of the current
processor. For 32-bit universal binaries the architecture is ``fat``, processor. For 32-bit universal binaries the architecture is ``fat``,
for 64-bit universal binaries the architecture is ``fat64``, and for 64-bit universal binaries the architecture is ``fat64``, and
for 4-way universal binaries the architecture is ``universal``. for 4-way universal binaries the architecture is ``universal``. Starting
from Python 2.7 and Python 3.2 the architecture ``fat3`` is used for
a 3-way universal build (ppc, i386, x86_64) and ``intel`` is used for
a univeral build with the i386 and x86_64 architectures
Examples of returned values on Mac OS X: Examples of returned values on Mac OS X:
@ -1105,6 +1108,8 @@ other utility module.
* ``macosx-10.5-universal`` * ``macosx-10.5-universal``
* ``macosx-10.6-intel``
.. % XXX isn't this also provided by some other non-distutils module? .. % XXX isn't this also provided by some other non-distutils module?

View File

@ -144,11 +144,26 @@ def get_platform():
machine = 'fat' machine = 'fat'
cflags = get_config_vars().get('CFLAGS') cflags = get_config_vars().get('CFLAGS')
if '-arch x86_64' in cflags: archs = re.findall('-arch\s+(\S+)', cflags)
if '-arch i386' in cflags: archs.sort()
machine = 'universal' archs = tuple(archs)
else:
machine = 'fat64' if len(archs) == 1:
machine = archs[0]
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
elif machine in ('PowerPC', 'Power_Macintosh'): elif machine in ('PowerPC', 'Power_Macintosh'):
# Pick a sane name for the PPC architecture. # Pick a sane name for the PPC architecture.