Skip to content

Commit 3cc7e42

Browse files
authored
add --version option to pybind11-config (#4526)
Without this, it's impossible to get feature parity between detection mechanisms. Both the pkg-config file and the cmake config set their versions, but the python probe script didn't provide an option for this. So you could print the compiler flags for using it, but you could not check what you got.
1 parent 438034c commit 3cc7e42

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pybind11/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import sysconfig
66

7+
from ._version import __version__
78
from .commands import get_cmake_dir, get_include, get_pkgconfig_dir
89

910

@@ -25,6 +26,12 @@ def print_includes() -> None:
2526

2627
def main() -> None:
2728
parser = argparse.ArgumentParser()
29+
parser.add_argument(
30+
"--version",
31+
action="version",
32+
version=__version__,
33+
help="Print the version and exit.",
34+
)
2835
parser.add_argument(
2936
"--includes",
3037
action="store_true",

0 commit comments

Comments
 (0)