~ubuntu-branches/ubuntu/natty/python2.6/natty-security

« back to all changes in this revision

Viewing changes to Lib/distutils/unixccompiler.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-06-24 00:31:14 UTC
  • mfrom: (10.1.18 sid)
  • Revision ID: james.westby@ubuntu.com-20100624003114-jmwmbudlpucl6ip3
Tags: 2.6.5+20100616-1ubuntu1
* Merge from Debian Unstable.  Remaining Ubuntu changes:
  - Add new symbols to libpython.symbols.in
  - Re-enable the profiled build on all architectures
  - Priority for python2.6-minimal is required instead of optional
  - python2.6-minimal and python2.6 Conflict python-central
    (<< 0.6.11ubuntu6)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
  * link shared library handled by 'cc -shared'
14
14
"""
15
15
 
16
 
__revision__ = "$Id: unixccompiler.py 77378 2010-01-08 23:48:37Z tarek.ziade $"
 
16
__revision__ = "$Id: unixccompiler.py 81674 2010-06-03 14:59:56Z ronald.oussoren $"
17
17
 
18
 
import os, sys
 
18
import os, sys, re
19
19
from types import StringType, NoneType
20
20
 
21
21
from distutils import sysconfig
305
305
        dylib_f = self.library_filename(lib, lib_type='dylib')
306
306
        static_f = self.library_filename(lib, lib_type='static')
307
307
 
 
308
        if sys.platform == 'darwin':
 
309
            # On OSX users can specify an alternate SDK using
 
310
            # '-isysroot', calculate the SDK root if it is specified
 
311
            # (and use it further on)
 
312
            cflags = sysconfig.get_config_var('CFLAGS')
 
313
            m = re.search(r'-isysroot\s+(\S+)', cflags)
 
314
            if m is None:
 
315
                sysroot = '/'
 
316
            else:
 
317
                sysroot = m.group(1)
 
318
 
 
319
 
 
320
 
308
321
        for dir in dirs:
309
322
            shared = os.path.join(dir, shared_f)
310
323
            dylib = os.path.join(dir, dylib_f)
311
324
            static = os.path.join(dir, static_f)
 
325
 
 
326
            if sys.platform == 'darwin' and (
 
327
                    dir.startswith('/System/') or dir.startswith('/usr/')):
 
328
                shared = os.path.join(sysroot, dir[1:], shared_f)
 
329
                dylib = os.path.join(sysroot, dir[1:], dylib_f)
 
330
                static = os.path.join(sysroot, dir[1:], static_f)
 
331
 
312
332
            # We're second-guessing the linker here, with not much hard
313
333
            # data to go on: GCC seems to prefer the shared library, so I'm
314
334
            # assuming that *all* Unix C compilers do.  And of course I'm