Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bea37ae

Browse files
Merged revisions 74806 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r74806 | ronald.oussoren | 2009-09-15 21:13:15 +0200 (Tue, 15 Sep 2009) | 3 lines Finish support for --with-universal-archs=intel and --with-universal-archs=3-way (issue6245) ........
1 parent d097efe commit bea37ae

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

Doc/distutils/apiref.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,10 @@ other utility module.
10951095
the univeral binary status instead of the architecture of the current
10961096
processor. For 32-bit universal binaries the architecture is ``fat``,
10971097
for 64-bit universal binaries the architecture is ``fat64``, and
1098-
for 4-way universal binaries the architecture is ``universal``.
1098+
for 4-way universal binaries the architecture is ``universal``. Starting
1099+
from Python 2.7 and Python 3.2 the architecture ``fat3`` is used for
1100+
a 3-way universal build (ppc, i386, x86_64) and ``intel`` is used for
1101+
a univeral build with the i386 and x86_64 architectures
10991102

11001103
Examples of returned values on Mac OS X:
11011104

@@ -1105,6 +1108,8 @@ other utility module.
11051108

11061109
* ``macosx-10.5-universal``
11071110

1111+
* ``macosx-10.6-intel``
1112+
11081113
.. % XXX isn't this also provided by some other non-distutils module?
11091114
11101115

Lib/distutils/util.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,26 @@ def get_platform():
144144
machine = 'fat'
145145
cflags = get_config_vars().get('CFLAGS')
146146

147-
if '-arch x86_64' in cflags:
148-
if '-arch i386' in cflags:
149-
machine = 'universal'
150-
else:
151-
machine = 'fat64'
147+
archs = re.findall('-arch\s+(\S+)', cflags)
148+
archs.sort()
149+
archs = tuple(archs)
150+
151+
if len(archs) == 1:
152+
machine = archs[0]
153+
elif archs == ('i386', 'ppc'):
154+
machine = 'fat'
155+
elif archs == ('i386', 'x86_64'):
156+
machine = 'intel'
157+
elif archs == ('i386', 'ppc', 'x86_64'):
158+
machine = 'fat3'
159+
elif archs == ('ppc64', 'x86_64'):
160+
machine = 'fat64'
161+
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
162+
machine = 'universal'
163+
else:
164+
raise ValueError(
165+
"Don't know machine value for archs=%r"%(archs,))
166+
152167

153168
elif machine in ('PowerPC', 'Power_Macintosh'):
154169
# Pick a sane name for the PPC architecture.

0 commit comments

Comments
 (0)