From 9b63382b03f7a595001d9900021eceab6394628c Mon Sep 17 00:00:00 2001 From: Ali Polatel Date: Sun, 26 Oct 2008 16:21:37 +0200 Subject: [PATCH 09/10] By default build dbm module with gdbm_compat preventing automagic dependencies. Organization: Gentoo --- setup.py | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index bd9886c..0d6605f 100644 --- a/setup.py +++ b/setup.py @@ -1012,21 +1012,15 @@ class PyBuildExt(build_ext): # The standard Unix dbm module: if platform not in ['cygwin']: - if find_file("ndbm.h", inc_dirs, []) is not None: - # Some systems have -lndbm, others don't - if self.compiler.find_library_file(lib_dirs, 'ndbm'): - ndbm_libs = ['ndbm'] - else: - ndbm_libs = [] - exts.append( Extension('dbm', ['dbmmodule.c'], - define_macros=[('HAVE_NDBM_H',None)], - libraries = ndbm_libs ) ) - elif (self.compiler.find_library_file(lib_dirs, 'gdbm') - and find_file("gdbm/ndbm.h", inc_dirs, []) is not None): + # To prevent automagic dependencies check for relevant modules in + # disabled_module_list. + if (self.compiler.find_library_file(lib_dirs, 'gdbm') + and find_file("gdbm/ndbm.h", inc_dirs, []) is not None + and 'gdbm' not in disabled_module_list): exts.append( Extension('dbm', ['dbmmodule.c'], define_macros=[('HAVE_GDBM_NDBM_H',None)], - libraries = ['gdbm'] ) ) - elif db_incs is not None: + libraries = ['gdbm', 'gdbm_compat'] ) ) + elif db_incs is not None and 'bsddb' not in disabled_module_list: exts.append( Extension('dbm', ['dbmmodule.c'], library_dirs=dblib_dir, runtime_library_dirs=dblib_dir, @@ -1034,6 +1028,18 @@ class PyBuildExt(build_ext): define_macros=[('HAVE_BERKDB_H',None), ('DB_DBM_HSEARCH',None)], libraries=dblibs)) + # Check for ndbm.h here after checking berkdb because ndbm.h is + # only provided by db-1* + elif (find_file("ndbm.h", inc_dirs, []) is not None + and 'bsddb' not in disabled_module_list): + # Some systems have -lndbm, others don't + if self.compiler.find_library_file(lib_dirs, 'ndbm'): + ndbm_libs = ['ndbm'] + else: + ndbm_libs = [] + exts.append( Extension('dbm', ['dbmmodule.c'], + define_macros=[('HAVE_NDBM_H',None)], + libraries = ndbm_libs ) ) else: missing.append('dbm') -- 1.6.0.2