__main__.py revision 12391:ceeca8b41e4b
1from __future__ import print_function
2
3import argparse
4import sys
5import sysconfig
6
7from . import get_include
8
9
10def print_includes():
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))
23
24
25def main():
26    parser = argparse.ArgumentParser(prog='python -m pybind11')
27    parser.add_argument('--includes', action='store_true',
28                        help='Include flags for both pybind11 and Python headers.')
29    args = parser.parse_args()
30    if not sys.argv[1:]:
31        parser.print_help()
32    if args.includes:
33        print_includes()
34
35
36if __name__ == '__main__':
37    main()
38