mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 08:32:02 +00:00
python -m pybind11 --includes
prints include paths
This commit is contained in:
parent
34b7b54f29
commit
6b442ff9e1
31
pybind11/__main__.py
Normal file
31
pybind11/__main__.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
import sysconfig
|
||||||
|
|
||||||
|
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))
|
||||||
|
|
||||||
|
|
||||||
|
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()
|
Loading…
Reference in New Issue
Block a user