~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Autodetecting setup.py script for building the Python extensions
2
2
#
3
3
 
4
 
__version__ = "$Revision: 75282 $"
 
4
__version__ = "$Revision: 78785 $"
5
5
 
6
6
import sys, os, imp, re, optparse
7
7
from glob import glob
556
556
 
557
557
        # readline
558
558
        do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
559
 
        if platform == 'darwin': # and os.uname()[2] < '9.':
560
 
            # MacOSX 10.4 has a broken readline. Don't try to build
561
 
            # the readline module unless the user has installed a fixed
562
 
            # readline package
563
 
            # FIXME: The readline emulation on 10.5 is better, but the
564
 
            # readline module doesn't compile out of the box.
565
 
            if find_file('readline/rlconf.h', inc_dirs, []) is None:
566
 
                do_readline = False
 
559
        if platform == 'darwin':
 
560
            os_release = int(os.uname()[2].split('.')[0])
 
561
            dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
 
562
            if dep_target and dep_target.split('.') < ['10', '5']:
 
563
                os_release = 8
 
564
            if os_release < 9:
 
565
                # MacOSX 10.4 has a broken readline. Don't try to build
 
566
                # the readline module unless the user has installed a fixed
 
567
                # readline package
 
568
                if find_file('readline/rlconf.h', inc_dirs, []) is None:
 
569
                    do_readline = False
567
570
        if do_readline:
568
 
            if sys.platform == 'darwin':
 
571
            if platform == 'darwin' and os_release < 9:
569
572
                # In every directory on the search path search for a dynamic
570
573
                # library and then a static library, instead of first looking
571
574
                # for dynamic libraries on the entiry path.
814
817
                                print "being ignored (4.6.x must be >= 4.6.21)"
815
818
                                continue
816
819
 
817
 
                        if ( (not db_ver_inc_map.has_key(db_ver)) and
 
820
                        if ( (db_ver not in db_ver_inc_map) and
818
821
                            allow_db_ver(db_ver) ):
819
822
                            # save the include directory with the db.h version
820
823
                            # (first occurrence only)
1065
1068
                missing.append('resource')
1066
1069
 
1067
1070
            # Sun yellow pages. Some systems have the functions in libc.
1068
 
            if platform not in ['cygwin', 'atheos', 'qnx6']:
 
1071
            if (platform not in ['cygwin', 'atheos', 'qnx6'] and
 
1072
                find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
1069
1073
                if (self.compiler.find_library_file(lib_dirs, 'nsl')):
1070
1074
                    libs = ['nsl']
1071
1075
                else:
1324
1328
            if macros.get('HAVE_SEM_OPEN', False):
1325
1329
                multiprocessing_srcs.append('_multiprocessing/semaphore.c')
1326
1330
 
1327
 
        exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
1328
 
                                 define_macros=macros.items(),
1329
 
                                 include_dirs=["Modules/_multiprocessing"]))
 
1331
        if sysconfig.get_config_var('WITH_THREAD'):
 
1332
            exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
 
1333
                                    define_macros=macros.items(),
 
1334
                                    include_dirs=["Modules/_multiprocessing"]))
 
1335
        else:
 
1336
            missing.append('_multiprocessing')
 
1337
 
1330
1338
        # End multiprocessing
1331
1339
 
1332
1340
 
1361
1369
        if platform == 'darwin' and ("--disable-toolbox-glue" not in
1362
1370
                sysconfig.get_config_var("CONFIG_ARGS")):
1363
1371
 
1364
 
            if os.uname()[2] > '8.':
 
1372
            if int(os.uname()[2].split('.')[0]) >= 8:
1365
1373
                # We're on Mac OS X 10.4 or later, the compiler should
1366
1374
                # support '-Wno-deprecated-declarations'. This will
1367
1375
                # surpress deprecation warnings for the Carbon extensions,
1711
1719
                    return False
1712
1720
 
1713
1721
            fficonfig = {}
1714
 
            execfile(ffi_configfile, globals(), fficonfig)
1715
 
            ffi_srcdir = os.path.join(fficonfig['ffi_srcdir'], 'src')
 
1722
            exec open(ffi_configfile) in fficonfig
1716
1723
 
1717
1724
            # Add .S (preprocessed assembly) to C compiler source extensions.
1718
1725
            self.compiler.src_extensions.append('.S')
1719
1726
 
1720
1727
            include_dirs = [os.path.join(ffi_builddir, 'include'),
1721
 
                            ffi_builddir, ffi_srcdir]
 
1728
                            ffi_builddir,
 
1729
                            os.path.join(ffi_srcdir, 'src')]
1722
1730
            extra_compile_args = fficonfig['ffi_cflags'].split()
1723
1731
 
1724
 
            ext.sources.extend(fficonfig['ffi_sources'])
 
1732
            ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
 
1733
                               fficonfig['ffi_sources'])
1725
1734
            ext.include_dirs.extend(include_dirs)
1726
1735
            ext.extra_compile_args.extend(extra_compile_args)
1727
1736
        return True