diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 76 |
1 files changed, 52 insertions, 24 deletions
@@ -1,8 +1,6 @@ # Autodetecting setup.py script for building the Python extensions # -__version__ = "$Revision$" - import sys, os, imp, re, optparse from glob import glob import sysconfig @@ -365,9 +363,8 @@ class PyBuildExt(build_ext): def get_platform(self): # Get value of sys.platform - for platform in ['cygwin', 'darwin', 'osf1']: - if sys.platform.startswith(platform): - return platform + if sys.platform.startswith('osf1'): + return 'osf1' return sys.platform def add_multiarch_paths(self): @@ -507,11 +504,17 @@ class PyBuildExt(build_ext): exts.append( Extension('math', ['mathmodule.c', '_math.c'], depends=['_math.h'], libraries=math_libs) ) + + # time libraries: librt may be needed for clock_gettime() + time_libs = [] + lib = sysconfig.get_config_var('TIMEMODULE_LIB') + if lib: + time_libs.append(lib) + # time operations and variables exts.append( Extension('time', ['timemodule.c', '_time.c'], - libraries=math_libs) ) - exts.append( Extension('_datetime', ['_datetimemodule.c', '_time.c'], - libraries=math_libs) ) + libraries=time_libs) ) + exts.append( Extension('_datetime', ['_datetimemodule.c', '_time.c']) ) # random number generator implemented in C exts.append( Extension("_random", ["_randommodule.c"]) ) # bisect @@ -527,6 +530,8 @@ class PyBuildExt(build_ext): # Python C API test module exts.append( Extension('_testcapi', ['_testcapimodule.c'], depends=['testcapi_long.h']) ) + # Python PEP-3118 (buffer protocol) test module + exts.append( Extension('_testbuffer', ['_testbuffer.c']) ) # profiler (_lsprof is for cProfile.py) exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) ) # static Unicode character database @@ -659,7 +664,7 @@ class PyBuildExt(build_ext): libs = ['crypt'] else: libs = [] - exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) + exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) ) # CSV files exts.append( Extension('_csv', ['_csv.c']) ) @@ -1047,10 +1052,15 @@ class PyBuildExt(build_ext): else: sqlite_extra_link_args = () + include_dirs = ["Modules/_sqlite"] + # Only include the directory where sqlite was found if it does + # not already exist in set include directories, otherwise you + # can end up with a bad search path order. + if sqlite_incdir not in self.compiler.include_dirs: + include_dirs.append(sqlite_incdir) exts.append(Extension('_sqlite3', sqlite_srcs, define_macros=sqlite_defines, - include_dirs=["Modules/_sqlite", - sqlite_incdir], + include_dirs=include_dirs, library_dirs=sqlite_libdir, runtime_library_dirs=sqlite_libdir, extra_link_args=sqlite_extra_link_args, @@ -1160,14 +1170,21 @@ class PyBuildExt(build_ext): # Curses support, requiring the System V version of curses, often # provided by the ncurses library. + curses_defines = [] + curses_includes = [] panel_library = 'panel' + if curses_library == 'ncursesw': + curses_defines.append(('HAVE_NCURSESW', '1')) + curses_includes.append('/usr/include/ncursesw') + # Bug 1464056: If _curses.so links with ncursesw, + # _curses_panel.so must link with panelw. + panel_library = 'panelw' + if curses_library.startswith('ncurses'): - if curses_library == 'ncursesw': - # Bug 1464056: If _curses.so links with ncursesw, - # _curses_panel.so must link with panelw. - panel_library = 'panelw' curses_libs = [curses_library] exts.append( Extension('_curses', ['_cursesmodule.c'], + include_dirs=curses_includes, + define_macros=curses_defines, libraries = curses_libs) ) elif curses_library == 'curses' and platform != 'darwin': # OSX has an old Berkeley curses, not good enough for @@ -1180,6 +1197,7 @@ class PyBuildExt(build_ext): curses_libs = ['curses'] exts.append( Extension('_curses', ['_cursesmodule.c'], + define_macros=curses_defines, libraries = curses_libs) ) else: missing.append('_curses') @@ -1188,6 +1206,7 @@ class PyBuildExt(build_ext): if (module_enabled(exts, '_curses') and self.compiler.find_library_file(lib_dirs, panel_library)): exts.append( Extension('_curses_panel', ['_curses_panel.c'], + include_dirs=curses_includes, libraries = [panel_library] + curses_libs) ) else: missing.append('_curses_panel') @@ -1256,11 +1275,18 @@ class PyBuildExt(build_ext): bz2_extra_link_args = ('-Wl,-search_paths_first',) else: bz2_extra_link_args = () - exts.append( Extension('bz2', ['bz2module.c'], + exts.append( Extension('_bz2', ['_bz2module.c'], libraries = ['bz2'], extra_link_args = bz2_extra_link_args) ) else: - missing.append('bz2') + missing.append('_bz2') + + # LZMA compression support. + if self.compiler.find_library_file(lib_dirs, 'lzma'): + exts.append( Extension('_lzma', ['_lzmamodule.c'], + libraries = ['lzma']) ) + else: + missing.append('_lzma') # Interface to the Expat XML parser # @@ -1353,14 +1379,11 @@ class PyBuildExt(build_ext): if platform == 'win32': multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', '_multiprocessing/semaphore.c', - '_multiprocessing/pipe_connection.c', - '_multiprocessing/socket_connection.c', '_multiprocessing/win32_functions.c' ] else: multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', - '_multiprocessing/socket_connection.c' ] if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')): @@ -1375,9 +1398,7 @@ class PyBuildExt(build_ext): # End multiprocessing # Platform-specific libraries - if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', - 'freebsd7', 'freebsd8') - or platform.startswith("gnukfreebsd")): + if platform.startswith(('linux', 'freebsd', 'gnukfreebsd')): exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) else: missing.append('ossaudiodev') @@ -1780,6 +1801,13 @@ class PyBuildInstall(install): install.initialize_options(self) self.warn_dir=0 + # Customize subcommands to not install an egg-info file for Python + sub_commands = [('install_lib', install.has_lib), + ('install_headers', install.has_headers), + ('install_scripts', install.has_scripts), + ('install_data', install.has_data)] + + class PyBuildInstallLib(install_lib): # Do exactly what install_lib does but make sure correct access modes get # set on installed directories and files. All installed files with get @@ -1892,7 +1920,7 @@ def main(): # check the PyBuildScripts command above, and change the links # created by the bininstall target in Makefile.pre.in scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", - "Tools/scripts/2to3"] + "Tools/scripts/2to3", "Tools/scripts/pysetup3"] ) # --install-platlib |