Skip to content

Commit

Permalink
feat: add --extension-suffix
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Sep 27, 2024
1 parent 20f37d8 commit 8ccca8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ On Linux, the above example can be compiled using the following command:

.. code-block:: bash
$ c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3 -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')
$ c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3 -m pybind11 --extension-suffix)
.. note::

Expand Down
7 changes: 7 additions & 0 deletions pybind11/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def main() -> None:
action="store_true",
help="Print the pkgconfig directory, ideal for setting $PKG_CONFIG_PATH.",
)
parser.add_argument(
"--extension-suffix",
action="store_true",
help="Print the extension for a Python module",
)
args = parser.parse_args()
if not sys.argv[1:]:
parser.print_help()
Expand All @@ -80,6 +85,8 @@ def main() -> None:
print(quote(get_cmake_dir()))
if args.pkgconfigdir:
print(quote(get_pkgconfig_dir()))
if args.extension_suffix:
print(sysconfig.get_config_var("EXT_SUFFIX"))


if __name__ == "__main__":
Expand Down

0 comments on commit 8ccca8d

Please sign in to comment.