From 3d8df5af033f05c9da300eb67eef3d490a8f7bf2 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Wed, 23 Aug 2017 16:59:10 +0200 Subject: [PATCH] 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] --- pybind11/__main__.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pybind11/__main__.py b/pybind11/__main__.py index c3832d7ca..9ef837802 100644 --- a/pybind11/__main__.py +++ b/pybind11/__main__.py @@ -8,12 +8,18 @@ from . import get_include def print_includes(): - dirs = [sysconfig.get_path('include')] - if sysconfig.get_path('platinclude') not in dirs: - dirs.append(sysconfig.get_path('platinclude')) - if get_include() not in dirs: - dirs.append(get_include()) - print(' '.join('-I' + d for d in dirs)) + dirs = [sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + get_include(), + get_include(True)] + + # Make unique but preserve order + unique_dirs = [] + for d in dirs: + if d not in unique_dirs: + unique_dirs.append(d) + + print(' '.join('-I' + d for d in unique_dirs)) def main():