summaryrefslogtreecommitdiff
path: root/ext/pybind11/pybind11/__main__.py
blob: 9ef8378029b435d7660a793a73f7ff53754d9f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from __future__ import print_function

import argparse
import sys
import sysconfig

from . import get_include


def print_includes():
    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():
    parser = argparse.ArgumentParser(prog='python -m pybind11')
    parser.add_argument('--includes', action='store_true',
                        help='Include flags for both pybind11 and Python headers.')
    args = parser.parse_args()
    if not sys.argv[1:]:
        parser.print_help()
    if args.includes:
        print_includes()


if __name__ == '__main__':
    main()