diff setup.py @ 70694:b313fc77fa11

When building sqlite3, the directory where sqlite.h was found was 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.
author Brett Cannon <brett@python.org>
date Mon, 06 Jun 2011 20:09:10 -0700
parents f3553d5083f8
children e3f6c10eb590
line wrap: on
line diff
--- a/setup.py	Mon Jun 06 23:43:02 2011 +0200
+++ b/setup.py	Mon Jun 06 20:09:10 2011 -0700
@@ -1045,10 +1045,15 @@
             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,