]> granicus.if.org Git - python/commitdiff
Issue #16116: Now uses corrected include and library paths when building C extensions...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 23 Oct 2012 19:26:14 +0000 (20:26 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 23 Oct 2012 19:26:14 +0000 (20:26 +0100)
Lib/distutils/command/build_ext.py
Misc/NEWS

index f16e2f17ef0f5b8ea04e6eef01459104ae3f81f1..b1d951e6f8919946afc3a3f78587f9c94b8732a6 100644 (file)
@@ -160,6 +160,11 @@ class build_ext(Command):
         if isinstance(self.include_dirs, str):
             self.include_dirs = self.include_dirs.split(os.pathsep)
 
+        # If in a virtualenv, add its include directory
+        # Issue 16116
+        if sys.exec_prefix != sys.base_exec_prefix:
+            self.include_dirs.append(os.path.join(sys.exec_prefix, 'include'))
+
         # Put the Python "system" include dir at the end, so that
         # any local include dirs take precedence.
         self.include_dirs.append(py_include)
@@ -190,6 +195,8 @@ class build_ext(Command):
             # must be the *native* platform.  But we don't really support
             # cross-compiling via a binary install anyway, so we let it go.
             self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
+            if sys.base_exec_prefix != sys.prefix:  # Issue 16116
+                self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs'))
             if self.debug:
                 self.build_temp = os.path.join(self.build_temp, "Debug")
             else:
index e868a235e01372748df36c09bdcd4bc924aabad8..d47585cde7202261ea53644599a1eb1278c80c4b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #16116: Fix include and library paths to be correctwhen  building C
+  extensions in venvs.
+
 - Issue #16245: Fix the value of a few entities in html.entities.html5.
 
 - Issue #14398: Fix size truncation and overflow bugs in the bz2 module.