Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3818a3

Browse files
committed
- 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.
1 parent aad7cc9 commit a3818a3

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ IDLE
167167
Build
168168
-----
169169

170+
- Issue #15234: For BerkelyDB and Sqlite, only add the found library and
171+
include directories if they aren't already being searched. This avoids
172+
an explicit runtime library dependency.
173+
170174
- Issue #20644: OS X installer build support for documentation build changes
171175
in 3.4.1: assume externally supplied sphinx-build is available in /usr/bin.
172176

setup.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,16 @@ class db_found(Exception): pass
10221022
if db_setup_debug:
10231023
print("bsddb using BerkeleyDB lib:", db_ver, dblib)
10241024
print("bsddb lib dir:", dblib_dir, " inc dir:", db_incdir)
1025-
db_incs = [db_incdir]
10261025
dblibs = [dblib]
1026+
# Only add the found library and include directories if they aren't
1027+
# already being searched. This avoids an explicit runtime library
1028+
# dependency.
1029+
if db_incdir in inc_dirs:
1030+
db_incs = None
1031+
else:
1032+
db_incs = [db_incdir]
1033+
if dblib_dir[0] in lib_dirs:
1034+
dblib_dir = None
10271035
else:
10281036
if db_setup_debug: print("db: no appropriate library found")
10291037
db_incs = None
@@ -1134,6 +1142,9 @@ class db_found(Exception): pass
11341142
# can end up with a bad search path order.
11351143
if sqlite_incdir not in self.compiler.include_dirs:
11361144
include_dirs.append(sqlite_incdir)
1145+
# avoid a runtime library path for a system library dir
1146+
if sqlite_libdir and sqlite_libdir[0] in lib_dirs:
1147+
sqlite_libdir = None
11371148
exts.append(Extension('_sqlite3', sqlite_srcs,
11381149
define_macros=sqlite_defines,
11391150
include_dirs=include_dirs,
@@ -1202,7 +1213,7 @@ class db_found(Exception): pass
12021213
libraries = gdbm_libs)
12031214
break
12041215
elif cand == "bdb":
1205-
if db_incs is not None:
1216+
if dblibs:
12061217
if dbm_setup_debug: print("building dbm using bdb")
12071218
dbmext = Extension('_dbm', ['_dbmmodule.c'],
12081219
library_dirs=dblib_dir,

0 commit comments

Comments
 (0)