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

Skip to content

Commit 998b105

Browse files
committed
Closes #16116: Merged fix from 3.3.
2 parents d2e90cd + e87acc1 commit 998b105

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/distutils/command/build_ext.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ def finalize_options(self):
160160
if isinstance(self.include_dirs, str):
161161
self.include_dirs = self.include_dirs.split(os.pathsep)
162162

163+
# If in a virtualenv, add its include directory
164+
# Issue 16116
165+
if sys.exec_prefix != sys.base_exec_prefix:
166+
self.include_dirs.append(os.path.join(sys.exec_prefix, 'include'))
167+
163168
# Put the Python "system" include dir at the end, so that
164169
# any local include dirs take precedence.
165170
self.include_dirs.append(py_include)
@@ -190,6 +195,8 @@ def finalize_options(self):
190195
# must be the *native* platform. But we don't really support
191196
# cross-compiling via a binary install anyway, so we let it go.
192197
self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
198+
if sys.base_exec_prefix != sys.prefix: # Issue 16116
199+
self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs'))
193200
if self.debug:
194201
self.build_temp = os.path.join(self.build_temp, "Debug")
195202
else:

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Core and Builtins
5959
Library
6060
-------
6161

62+
- Issue #16116: Fix include and library paths to be correctwhen building C
63+
extensions in venvs.
64+
6265
- Issue #16245: Fix the value of a few entities in html.entities.html5.
6366

6467
- Issue #16301: Fix the localhost verification in urllib/request.py for file://

0 commit comments

Comments
 (0)