μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
__main__.py
Go to the documentation of this file.
1# pylint: disable=missing-function-docstring
2
3import argparse
4import sys
5import sysconfig
6
7from ._version import __version__
8from .commands import get_cmake_dir, get_include, get_pkgconfig_dir
9
10
11def print_includes() -> None:
12 dirs = [
13 sysconfig.get_path("include"),
14 sysconfig.get_path("platinclude"),
15 get_include(),
16 ]
17
18 # Make unique but preserve order
19 unique_dirs = []
20 for d in dirs:
21 if d and d not in unique_dirs:
22 unique_dirs.append(d)
23
24 print(" ".join("-I" + d for d in unique_dirs))
25
26
27def main() -> None:
28 parser = argparse.ArgumentParser()
29 parser.add_argument(
30 "--version",
31 action="version",
32 version=__version__,
33 help="Print the version and exit.",
34 )
35 parser.add_argument(
36 "--includes",
37 action="store_true",
38 help="Include flags for both pybind11 and Python headers.",
39 )
40 parser.add_argument(
41 "--cmakedir",
42 action="store_true",
43 help="Print the CMake module directory, ideal for setting -Dpybind11_ROOT in CMake.",
44 )
45 parser.add_argument(
46 "--pkgconfigdir",
47 action="store_true",
48 help="Print the pkgconfig directory, ideal for setting $PKG_CONFIG_PATH.",
49 )
50 args = parser.parse_args()
51 if not sys.argv[1:]:
52 parser.print_help()
53 if args.includes:
54 print_includes()
55 if args.cmakedir:
56 print(get_cmake_dir())
57 if args.pkgconfigdir:
58 print(get_pkgconfig_dir())
59
60
61if __name__ == "__main__":
62 main()
int main(int argc, char *argv[])
Definition: generator.cxx:423