[Python-checkins] cpython (merge 3.3 -> default): Closes #16116: Merged fix from 3.3.

vinay.sajip python-checkins at python.org
Tue Oct 23 21:27:57 CEST 2012


http://hg.python.org/cpython/rev/5e9f656c3d67
changeset:   79922:5e9f656c3d67
parent:      79920:fb80df16c4ff
parent:      79921:43f537339107
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Tue Oct 23 20:27:43 2012 +0100
summary:
  Closes #16116: Merged fix from 3.3.

files:
  Lib/distutils/command/build_ext.py |  7 +++++++
  Misc/NEWS                          |  3 +++
  2 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -160,6 +160,11 @@
         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 @@
             # 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:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -59,6 +59,9 @@
 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 #16301: Fix the localhost verification in urllib/request.py for file://

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


More information about the Python-checkins mailing list