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

Skip to content

Commit c39d762

Browse files
committed
Merged revisions 67982,67988,67990 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r67982 | benjamin.peterson | 2008-12-28 09:37:31 -0600 (Sun, 28 Dec 2008) | 1 line fix WORD_BIGEDIAN declaration in Universal builds; fixes #4060 and #4728 ........ r67988 | ronald.oussoren | 2008-12-28 13:40:56 -0600 (Sun, 28 Dec 2008) | 1 line Issue4064: architecture string for universal builds on OSX ........ r67990 | ronald.oussoren | 2008-12-28 13:50:40 -0600 (Sun, 28 Dec 2008) | 3 lines Update the fix for issue4064 to deal correctly with all three variants of universal builds that are presented by the configure script. ........
1 parent 360e98c commit c39d762

3 files changed

Lines changed: 48 additions & 6 deletions

File tree

Doc/distutils/apiref.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,24 @@ other utility module.
11001100

11011101
For non-POSIX platforms, currently just returns ``sys.platform``.
11021102

1103+
For MacOS X systems the OS version reflects the minimal version on which
1104+
binaries will run (that is, the value of ``MACOSX_DEPLOYMENT_TARGET``
1105+
during the build of Python), not the OS version of the current system.
1106+
1107+
For universal binary builds on MacOS X the architecture value reflects
1108+
the univeral binary status instead of the architecture of the current
1109+
processor. For 32-bit universal binaries the architecture is ``fat``,
1110+
for 64-bit universal binaries the architecture is ``fat64``, and
1111+
for 4-way universal binaries the architecture is ``universal``.
1112+
1113+
Examples of returned values on MacOS X:
1114+
1115+
* ``macosx-10.3-ppc``
1116+
1117+
* ``macosx-10.3-fat``
1118+
1119+
* ``macosx-10.5-universal``
1120+
11031121
.. % XXX isn't this also provided by some other non-distutils module?
11041122
11051123

Include/pymacconfig.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# undef SIZEOF_SIZE_T
1616
# undef SIZEOF_TIME_T
1717
# undef SIZEOF_VOID_P
18+
# undef SIZEOF__BOOL
19+
# undef WORDS_BIGENDIAN
1820

1921
# undef VA_LIST_IS_ARRAY
2022
# if defined(__LP64__) && defined(__x86_64__)
@@ -28,12 +30,19 @@
2830

2931
# undef SIZEOF_LONG
3032
# ifdef __LP64__
33+
# define SIZEOF__BOOL 1
34+
# define SIZEOF__BOOL 1
3135
# define SIZEOF_LONG 8
3236
# define SIZEOF_PTHREAD_T 8
3337
# define SIZEOF_SIZE_T 8
3438
# define SIZEOF_TIME_T 8
3539
# define SIZEOF_VOID_P 8
3640
# else
41+
# ifdef __ppc__
42+
# define SIZEOF__BOOL 4
43+
# else
44+
# define SIZEOF__BOOL 1
45+
# endif
3746
# define SIZEOF_LONG 4
3847
# define SIZEOF_PTHREAD_T 4
3948
# define SIZEOF_SIZE_T 4
@@ -54,6 +63,11 @@
5463

5564
# endif
5665

66+
#ifdef __BIG_ENDIAN__
67+
#define WORDS_BIGENDIAN 1
68+
#endif /* __BIG_ENDIAN */
69+
70+
5771
#endif /* defined(_APPLE__) */
5872

5973
#endif /* PYMACCONFIG_H */

Lib/distutils/util.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ def get_platform ():
9999
if not macver:
100100
macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET')
101101

102-
if not macver:
102+
if 1:
103+
# Always calculate the release of the running machine,
104+
# needed to determine if we can build fat binaries or not.
105+
106+
macrelease = macver
103107
# Get the system version. Reading this plist is a documented
104108
# way to get the system version (see the documentation for
105109
# the Gestalt Manager)
@@ -115,16 +119,18 @@ def get_platform ():
115119
r'<string>(.*?)</string>', f.read())
116120
f.close()
117121
if m is not None:
118-
macver = '.'.join(m.group(1).split('.')[:2])
122+
macrelease = '.'.join(m.group(1).split('.')[:2])
119123
# else: fall back to the default behaviour
120124

125+
if not macver:
126+
macver = macrelease
127+
121128
if macver:
122129
from distutils.sysconfig import get_config_vars
123130
release = macver
124131
osname = "macosx"
125132

126-
127-
if (release + '.') >= '10.4.' and \
133+
if (macrelease + '.') >= '10.4.' and \
128134
'-arch' in get_config_vars().get('CFLAGS', '').strip():
129135
# The universal build will build fat binaries, but not on
130136
# systems before 10.4
@@ -133,9 +139,13 @@ def get_platform ():
133139
# 'universal' instead of 'fat'.
134140

135141
machine = 'fat'
142+
cflags = get_config_vars().get('CFLAGS')
136143

137-
if '-arch x86_64' in get_config_vars().get('CFLAGS'):
138-
machine = 'universal'
144+
if '-arch x86_64' in cflags:
145+
if '-arch i386' in cflags:
146+
machine = 'universal'
147+
else:
148+
machine = 'fat64'
139149

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

0 commit comments

Comments
 (0)