()
| 50 | |
| 51 | |
| 52 | def main() -> None: |
| 53 | make_parser = functools.partial(argparse.ArgumentParser, allow_abbrev=False) |
| 54 | if sys.version_info >= (3, 14): |
| 55 | make_parser = functools.partial(make_parser, color=True, suggest_on_error=True) |
| 56 | parser = make_parser() |
| 57 | parser.add_argument( |
| 58 | "--version", |
| 59 | action="version", |
| 60 | version=__version__, |
| 61 | help="Print the version and exit.", |
| 62 | ) |
| 63 | parser.add_argument( |
| 64 | "--includes", |
| 65 | action="store_true", |
| 66 | help="Include flags for both pybind11 and Python headers.", |
| 67 | ) |
| 68 | parser.add_argument( |
| 69 | "--cmakedir", |
| 70 | action="store_true", |
| 71 | help="Print the CMake module directory, ideal for setting -Dpybind11_ROOT in CMake.", |
| 72 | ) |
| 73 | parser.add_argument( |
| 74 | "--pkgconfigdir", |
| 75 | action="store_true", |
| 76 | help="Print the pkgconfig directory, ideal for setting $PKG_CONFIG_PATH.", |
| 77 | ) |
| 78 | parser.add_argument( |
| 79 | "--extension-suffix", |
| 80 | action="store_true", |
| 81 | help="Print the extension for a Python module", |
| 82 | ) |
| 83 | args = parser.parse_args() |
| 84 | if not sys.argv[1:]: |
| 85 | parser.print_help() |
| 86 | if args.includes: |
| 87 | print_includes() |
| 88 | if args.cmakedir: |
| 89 | print(quote(get_cmake_dir())) |
| 90 | if args.pkgconfigdir: |
| 91 | print(quote(get_pkgconfig_dir())) |
| 92 | if args.extension_suffix: |
| 93 | print(sysconfig.get_config_var("EXT_SUFFIX")) |
| 94 | |
| 95 | |
| 96 | if __name__ == "__main__": |
no test coverage detected