]> granicus.if.org Git - python/commitdiff
When building sqlite3, the directory where sqlite.h was found was
authorBrett Cannon <brett@python.org>
Tue, 7 Jun 2011 03:09:10 +0000 (20:09 -0700)
committerBrett Cannon <brett@python.org>
Tue, 7 Jun 2011 03:09:10 +0000 (20:09 -0700)
always appended to the include directories regardless of whether it
was already in the list of directories. This could cause issue if
sqlite was installed in the same location as another install of
Python. Now a check is done to make sure the directory is not included
twice.

Misc/NEWS
setup.py

index 296d86435091d069e04361d7f042ee7009bad098..874498b99fa3cf7e343da756ab8b40e2552759dd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -771,6 +771,9 @@ Library
 Build
 -----
 
+- Do not accidentally include the directory containing sqlite.h twice when
+  building sqlite3.
+
 - Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds,
   ensure "make install" creates symlinks in --prefix bin for the "-32"
   files in the framework bin directory like the installer does.
index 896d6046f030be593e4fcfc93ac1551485f38186..39751c3b0aed6c2ab89f437573040bccc50b521f 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1045,10 +1045,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,