diff --git a/tools/FindPythonLibsNew.cmake b/tools/FindPythonLibsNew.cmake index 4f5cf00ae..b7125912c 100644 --- a/tools/FindPythonLibsNew.cmake +++ b/tools/FindPythonLibsNew.cmake @@ -115,7 +115,7 @@ print('.'.join(str(v) for v in sys.version_info)); print(sys.prefix); print(s.get_python_inc(plat_specific=True)); print(s.get_python_lib(plat_specific=True)); -print(s.get_config_var('SO') or s.get_config_var('EXT_SUFFIX')); +print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO')); print(hasattr(sys, 'gettotalrefcount')+0); print(struct.calcsize('@P')); print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION')); diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake index 01b66535a..357cc61c1 100644 --- a/tools/pybind11NewTools.cmake +++ b/tools/pybind11NewTools.cmake @@ -95,8 +95,9 @@ endif() # required for PyPy3 (as of 7.3.1) if(NOT DEFINED PYTHON_MODULE_EXTENSION) execute_process( - COMMAND "${${_Python}_EXECUTABLE}" "-c" - "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" + COMMAND + "${${_Python}_EXECUTABLE}" "-c" + "from distutils import sysconfig as s;print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'))" OUTPUT_VARIABLE _PYTHON_MODULE_EXTENSION ERROR_VARIABLE _PYTHON_MODULE_EXTENSION_ERR OUTPUT_STRIP_TRAILING_WHITESPACE)