summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-03-17 13:50:43 (GMT)
committerBrad King <brad.king@kitware.com>2020-03-17 14:08:34 (GMT)
commitcc7f116cb409236697c4a17e5ad012e7c2790ce5 (patch)
tree81ab3601b9d3810faf46dfdf475d4ea155b2c178 /Modules
parent1ec72e09471287630cf142d8587a9b8d9abad629 (diff)
downloadCMake-cc7f116cb409236697c4a17e5ad012e7c2790ce5.zip
CMake-cc7f116cb409236697c4a17e5ad012e7c2790ce5.tar.gz
CMake-cc7f116cb409236697c4a17e5ad012e7c2790ce5.tar.bz2
FindPython: fix regression on version validation
In commit 3dab4682f6 (FindPython: reduces consumption of resources, 2020-02-10, v3.17.0-rc1~11^2) we accidentally broke the python executable version validation when the "LOCATION" strategy is used with the plain `FindPython` module. Fix the logic and add test cases covering those combinations. Fixes: #20465
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPython/Support.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 32c5283..ce06458 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -316,7 +316,7 @@ 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}")
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
endif()
endif()
endif()
@@ -357,7 +357,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
list (GET _soabi 1 _values)
if (_values)
# clean-up: remove prefix character and suffix
- string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\.(so|pyd))$" "\\1" _values "${_values}")
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
endif()
endif()
endif()
@@ -527,8 +527,8 @@ function (_PYTHON_VALIDATE_INTERPRETER)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
else()
# check that version is OK
- string(REGEX REPLACE "^([0-9]+)\." "\\1" major_version "${version}")
- string(REGEX REPLACE "^([0-9]+)\." "\\1" expected_major_version "${expected_version}")
+ string(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" major_version "${version}")
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${expected_version}")
if (NOT major_version VERSION_EQUAL expected_major_version
OR NOT version VERSION_GREATER_EQUAL expected_version)
set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")