8000 BLD: find Python.h when build_ext --include-dirs is set · matthew-brett/numpy@b08f369 · GitHub
[go: up one dir, main page]

Skip to content

Commit b08f369

Browse files
committed
BLD: find Python.h when build_ext --include-dirs is set
Ensure that build_ext.include_dirs is the same physical list as build_ext.distribution.include_dirs.
1 parent c65fc9e commit b08f369

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

numpy/distutils/command/build_ext.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,24 @@ def finalize_options(self):
5454
self.jobs = int(self.jobs)
5555
except ValueError:
5656
raise ValueError("--jobs/-j argument must be an integer")
57-
incl_dirs = self.include_dirs
57+
58+
# Ensure that self.include_dirs and self.distribution.include_dirs
59+
# refer to the same list object. finalize_options will modify
60+
# self.include_dirs, but self.distribution.include_dirs is used
61+
# during the actual build.
62+
# self.include_dirs is None unless paths are specified with
63+
# --include-dirs.
64+
# The include paths will be passed to the compiler in the order:
65+
# numpy paths, --include-dirs paths, Python include path.
66+
if isinstance(self.include_dirs, str):
67+
self.include_dirs = self.include_dirs.split(os.pathsep)
68+
incl_dirs = self.include_dirs or []
69+
if self.distribution.include_dirs is None:
70+
self.distribution.include_dirs = []
71+
self.include_dirs = self.distribution.include_dirs
72+
self.include_dirs.extend(incl_dirs)
73+
5874
old_build_ext.finalize_options(self)
59-
if incl_dirs is not None:
60-
self.include_dirs.extend(self.distribution.include_dirs or [])
6175
self.set_undefined_options('build', ('jobs', 'jobs'))
6276

6377
def run(self):

0 commit comments

Comments
 (0)
0