[Python-checkins] cpython (3.4): - Issue #15234: For BerkelyDB and Sqlite, only add the found library and

matthias.klose python-checkins at python.org
Thu Apr 17 17:55:49 CEST 2014


http://hg.python.org/cpython/rev/1a00e04a233d
changeset:   90381:1a00e04a233d
branch:      3.4
parent:      90376:503bf9dee28e
user:        doko at ubuntu.com
date:        Thu Apr 17 17:52:48 2014 +0200
summary:
  - Issue #15234: For BerkelyDB and Sqlite, only add the found library and
  include directories if they aren't already being searched. This avoids
  an explicit runtime library dependency.

files:
  Misc/NEWS |   4 ++++
  setup.py  |  15 +++++++++++++--
  2 files changed, 17 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -167,6 +167,10 @@
 Build
 -----
 
+- Issue #15234: For BerkelyDB and Sqlite, only add the found library and
+  include directories if they aren't already being searched. This avoids
+  an explicit runtime library dependency.
+
 - Issue #20644: OS X installer build support for documentation build changes
   in 3.4.1: assume externally supplied sphinx-build is available in /usr/bin.
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1022,8 +1022,16 @@
             if db_setup_debug:
                 print("bsddb using BerkeleyDB lib:", db_ver, dblib)
                 print("bsddb lib dir:", dblib_dir, " inc dir:", db_incdir)
-            db_incs = [db_incdir]
             dblibs = [dblib]
+            # Only add the found library and include directories if they aren't
+            # already being searched. This avoids an explicit runtime library
+            # dependency.
+            if db_incdir in inc_dirs:
+                db_incs = None
+            else:
+                db_incs = [db_incdir]
+            if dblib_dir[0] in lib_dirs:
+                dblib_dir = None
         else:
             if db_setup_debug: print("db: no appropriate library found")
             db_incs = None
@@ -1134,6 +1142,9 @@
             # can end up with a bad search path order.
             if sqlite_incdir not in self.compiler.include_dirs:
                 include_dirs.append(sqlite_incdir)
+            # avoid a runtime library path for a system library dir
+            if sqlite_libdir and sqlite_libdir[0] in lib_dirs:
+                sqlite_libdir = None
             exts.append(Extension('_sqlite3', sqlite_srcs,
                                   define_macros=sqlite_defines,
                                   include_dirs=include_dirs,
@@ -1202,7 +1213,7 @@
                                 libraries = gdbm_libs)
                             break
                 elif cand == "bdb":
-                    if db_incs is not None:
+                    if dblibs:
                         if dbm_setup_debug: print("building dbm using bdb")
                         dbmext = Extension('_dbm', ['_dbmmodule.c'],
                                            library_dirs=dblib_dir,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list