Skip to content

Commit 6b442ff

Browse files
aldanordean0x7d
authored andcommitted
python -m pybind11 --includes prints include paths
1 parent 34b7b54 commit 6b442ff

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

pybind11/__main__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from __future__ import print_function
2+
3+
import argparse
4+
import sys
5+
import sysconfig
6+
7+
from . import get_include
8+
9+
10+
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))
17+
18+
19+
def main():
20+
parser = argparse.ArgumentParser(prog='python -m pybind11')
21+
parser.add_argument('--includes', action='store_true',
22+
help='Include flags for both pybind11 and Python headers.')
23+
args = parser.parse_args()
24+
if not sys.argv[1:]:
25+
parser.print_help()
26+
if args.includes:
27+
print_includes()
28+
29+
30+
if __name__ == '__main__':
31+
main()

0 commit comments

Comments
 (0)