Skip to content

Commit c19c291

Browse files
nikulpatel3141Nikul Patelhenryiii
authored
feat: --extension-suffix for pybind11 command (#5360)
* fix docs build command on different global and venv python versions * feat: add --extension-suffix Signed-off-by: Henry Schreiner <[email protected]> --------- Signed-off-by: Henry Schreiner <[email protected]> Co-authored-by: Nikul Patel <nikul@z830> Co-authored-by: Henry Schreiner <[email protected]>
1 parent 167bb5f commit c19c291

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/basics.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ On Linux, the above example can be compiled using the following command:
142142

143143
.. code-block:: bash
144144
145-
$ c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3-config --extension-suffix)
145+
$ c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3 -m pybind11 --extension-suffix)
146146
147147
.. note::
148148

pybind11/__main__.py

+7
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def main() -> None:
7171
action="store_true",
7272
help="Print the pkgconfig directory, ideal for setting $PKG_CONFIG_PATH.",
7373
)
74+
parser.add_argument(
75+
"--extension-suffix",
76+
action="store_true",
77+
help="Print the extension for a Python module",
78+
)
7479
args = parser.parse_args()
7580
if not sys.argv[1:]:
7681
parser.print_help()
@@ -80,6 +85,8 @@ def main() -> None:
8085
print(quote(get_cmake_dir()))
8186
if args.pkgconfigdir:
8287
print(quote(get_pkgconfig_dir()))
88+
if args.extension_suffix:
89+
print(sysconfig.get_config_var("EXT_SUFFIX"))
8390

8491

8592
if __name__ == "__main__":

0 commit comments

Comments
 (0)