Skip to content

Commit 3d8df5a

Browse files
committed
Fix missing user dir in python -m pybind11 --includes
For the case of `pip install --user`, the header include dirs must also include `pybind11.get_include(True)`. [skip appveyor]
1 parent 1913f25 commit 3d8df5a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pybind11/__main__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@
88

99

1010
def print_includes():
11-
dirs = [sysconfig.get_path('include')]
12-
if sysconfig.get_path('platinclude') not in dirs:
13-
dirs.append(sysconfig.get_path('platinclude'))
14-
if get_include() not in dirs:
15-
dirs.append(get_include())
16-
print(' '.join('-I' + d for d in dirs))
11+
dirs = [sysconfig.get_path('include'),
12+
sysconfig.get_path('platinclude'),
13+
get_include(),
14+
get_include(True)]
15+
16+
# Make unique but preserve order
17+
unique_dirs = []
18+
for d in dirs:
19+
if d not in unique_dirs:
20+
unique_dirs.append(d)
21+
22+
print(' '.join('-I' + d for d in unique_dirs))
1723

1824

1925
def main():

0 commit comments

Comments
 (0)