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

Skip to content

Commit 1561ae1

Browse files
committed
Use 'get_python_inc()' to figure out the Python include directories
rather than cobbling them togethere here.
1 parent 2b9e43f commit 1561ae1

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

Lib/distutils/command/build_ext.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,9 @@ def finalize_options (self):
105105

106106

107107
# Make sure Python's include directories (for Python.h, config.h,
108-
# etc.) are in the include search path. We have to roll our own
109-
# "exec include dir", because the Makefile parsed by sysconfig
110-
# doesn't have it (sigh).
111-
py_include = sysconfig.INCLUDEPY # prefix + "include" + "python" + ver
112-
exec_py_include = os.path.join (sysconfig.exec_prefix, 'include',
113-
'python' + sys.version[0:3])
108+
# etc.) are in the include search path.
109+
py_include = sysconfig.get_python_inc()
110+
plat_py_include = sysconfig.get_python_inc(plat_specific=1)
114111
if self.include_dirs is None:
115112
self.include_dirs = self.distribution.include_dirs or []
116113
if type (self.include_dirs) is StringType:
@@ -120,8 +117,8 @@ def finalize_options (self):
120117
# Put the Python "system" include dir at the end, so that
121118
# any local include dirs take precedence.
122119
self.include_dirs.append (py_include)
123-
if exec_py_include != py_include:
124-
self.include_dirs.insert (0, exec_py_include)
120+
if plat_py_include != py_include:
121+
self.include_dirs.append (plat_py_include)
125122

126123
if type (self.libraries) is StringType:
127124
self.libraries = [self.libraries]

0 commit comments

Comments
 (0)