mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 06:35:12 +00:00
fix: module extension detection for python 3.10 (#3663)
* Fix module extension detection for python 3.10 * Fix for python < 3.10 * Use importlib
This commit is contained in:
parent
07103d6570
commit
dc4717bac2
@ -110,7 +110,7 @@ if(NOT DEFINED PYTHON_MODULE_EXTENSION)
|
|||||||
execute_process(
|
execute_process(
|
||||||
COMMAND
|
COMMAND
|
||||||
"${${_Python}_EXECUTABLE}" "-c"
|
"${${_Python}_EXECUTABLE}" "-c"
|
||||||
"from distutils import sysconfig as s;print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'))"
|
"import sys, importlib; s = importlib.import_module('distutils.sysconfig' if sys.version_info < (3, 10) else 'sysconfig'); print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'))"
|
||||||
OUTPUT_VARIABLE _PYTHON_MODULE_EXTENSION
|
OUTPUT_VARIABLE _PYTHON_MODULE_EXTENSION
|
||||||
ERROR_VARIABLE _PYTHON_MODULE_EXTENSION_ERR
|
ERROR_VARIABLE _PYTHON_MODULE_EXTENSION_ERR
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
Loading…
Reference in New Issue
Block a user