summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/unixccompiler.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-06-03 14:42:25 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2010-06-03 14:42:25 (GMT)
commit2c12ab18bcfc2925572397d0bb0e580f0021cf8c (patch)
tree2f488b598ff5e1a9c87358a7766cd6ef67768fcc /Lib/distutils/unixccompiler.py
parent1b51272b1b2565c60116119e1d4ac92602f66954 (diff)
downloadcpython-2c12ab18bcfc2925572397d0bb0e580f0021cf8c.zip
cpython-2c12ab18bcfc2925572397d0bb0e580f0021cf8c.tar.gz
cpython-2c12ab18bcfc2925572397d0bb0e580f0021cf8c.tar.bz2
Merged revisions 81662 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81662 | ronald.oussoren | 2010-06-03 11:47:21 +0200 (Thu, 03 Jun 2010) | 9 lines Fix for issue #7724: ensure that distutils and python's own setup.py honor the MacOSX SDK when one is specified. This is needed to be able to build using the 10.4u SDK while running on OSX 10.6. This is a fixed version of the patch in r80963, I've tested this patch on OSX and Linux. ........
Diffstat (limited to 'Lib/distutils/unixccompiler.py')
-rw-r--r--Lib/distutils/unixccompiler.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index c14a5d3..81a7de6 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -15,7 +15,7 @@ the "typical" Unix-style command-line C compiler:
__revision__ = "$Id$"
-import os, sys
+import os, sys, re
from distutils.dep_util import newer
from distutils.ccompiler import \
@@ -320,10 +320,31 @@ class UnixCCompiler(CCompiler):
dylib_f = self.library_filename(lib, lib_type='dylib')
static_f = self.library_filename(lib, lib_type='static')
+ if sys.platform == 'darwin':
+ # On OSX users can specify an alternate SDK using
+ # '-isysroot', calculate the SDK root if it is specified
+ # (and use it further on)
+ _sysconfig = __import__('sysconfig')
+ cflags = _sysconfig.get_config_var('CFLAGS')
+ m = re.search(r'-isysroot\s+(\S+)', cflags)
+ if m is None:
+ sysroot = '/'
+ else:
+ sysroot = m.group(1)
+
+
+
for dir in dirs:
shared = os.path.join(dir, shared_f)
dylib = os.path.join(dir, dylib_f)
static = os.path.join(dir, static_f)
+
+ if sys.platform == 'darwin' and (
+ dir.startswith('/System/') or dir.startswith('/usr/')):
+ shared = os.path.join(sysroot, dir[1:], shared_f)
+ dylib = os.path.join(sysroot, dir[1:], dylib_f)
+ static = os.path.join(sysroot, dir[1:], static_f)
+
# We're second-guessing the linker here, with not much hard
# data to go on: GCC seems to prefer the shared library, so I'm
# assuming that *all* Unix C compilers do. And of course I'm