summaryrefslogtreecommitdiff
path: root/Modules/FindPython
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-12-04 13:58:34 -0500
committerBen Boeckel <ben.boeckel@kitware.com>2020-12-04 14:01:27 -0500
commitafb0ffcac7852e1c2d7472ee914081e5eaf0cfe0 (patch)
tree288bf9a5df6cba7bd44c92857ba4a079deaa7dfc /Modules/FindPython
parent1a059d91af07993a02a85f4d6043a8e28742aab0 (diff)
downloadcmake-afb0ffcac7852e1c2d7472ee914081e5eaf0cfe0.tar.gz
FindPython2: avoid doubling the extension in CPython2 SOABI
Commit 951640f1f9 (FindPython: manage SOABI for all Python versions, 2020-08-11) extended support for Python2's SOABI variable in order to support the PyPy interpreter as well. This caused a regression in the way that the SOABI variable was built up for the CPython interpreter. This caused the variable to be set to `.so` which ended up causing a doubling of the resulting `SOABI` variable in the end. Co-Author: Marc Chevrier <marc.chevrier@gmail.com> Fixes: #21548
Diffstat (limited to 'Modules/FindPython')
-rw-r--r--Modules/FindPython/Support.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index c8225c4c58..3732463d06 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -452,7 +452,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
list (REMOVE_DUPLICATES _values)
elseif (NAME STREQUAL "SOABI")
# clean-up: remove prefix character and suffix
- string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ set(_values "")
+ else()
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ endif()
endif()
endif()
endif()
@@ -504,7 +508,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endforeach()
if (_values)
# clean-up: remove prefix character and suffix
- string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ set(_values "")
+ else()
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ endif()
endif()
endif()
else()