112391Sjason@lowepower.comfrom __future__ import print_function
212391Sjason@lowepower.com
312391Sjason@lowepower.comimport argparse
412391Sjason@lowepower.comimport sys
512391Sjason@lowepower.comimport sysconfig
612391Sjason@lowepower.com
712391Sjason@lowepower.comfrom . import get_include
812391Sjason@lowepower.com
912391Sjason@lowepower.com
1012391Sjason@lowepower.comdef print_includes():
1112391Sjason@lowepower.com    dirs = [sysconfig.get_path('include'),
1212391Sjason@lowepower.com            sysconfig.get_path('platinclude'),
1312391Sjason@lowepower.com            get_include(),
1412391Sjason@lowepower.com            get_include(True)]
1512391Sjason@lowepower.com
1612391Sjason@lowepower.com    # Make unique but preserve order
1712391Sjason@lowepower.com    unique_dirs = []
1812391Sjason@lowepower.com    for d in dirs:
1912391Sjason@lowepower.com        if d not in unique_dirs:
2012391Sjason@lowepower.com            unique_dirs.append(d)
2112391Sjason@lowepower.com
2212391Sjason@lowepower.com    print(' '.join('-I' + d for d in unique_dirs))
2312391Sjason@lowepower.com
2412391Sjason@lowepower.com
2512391Sjason@lowepower.comdef main():
2612391Sjason@lowepower.com    parser = argparse.ArgumentParser(prog='python -m pybind11')
2712391Sjason@lowepower.com    parser.add_argument('--includes', action='store_true',
2812391Sjason@lowepower.com                        help='Include flags for both pybind11 and Python headers.')
2912391Sjason@lowepower.com    args = parser.parse_args()
3012391Sjason@lowepower.com    if not sys.argv[1:]:
3112391Sjason@lowepower.com        parser.print_help()
3212391Sjason@lowepower.com    if args.includes:
3312391Sjason@lowepower.com        print_includes()
3412391Sjason@lowepower.com
3512391Sjason@lowepower.com
3612391Sjason@lowepower.comif __name__ == '__main__':
3712391Sjason@lowepower.com    main()
38