Skip to content

Commit 53158e3

Browse files
authored
Merge pull request InsightSoftwareConsortium#5686 from InsightSoftwareConsortium/fix-exact-version-match
ENH: Python version exact match requested for range
2 parents 54f8952 + d783a4f commit 53158e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMake/ITKSetPython3Vars.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ set(PYTHON_VERSION_MAX 3.999)
1212
if(DEFINED Python3_EXECUTABLE) # if already specified
1313
set(_specified_Python3_EXECUTABLE ${Python3_EXECUTABLE})
1414
# If a specific Python executable is provided, lock the Python version range
15-
# to the exact version of that executable so FindPython3 searches that version.
15+
# to the exact version down to the minor release of that executable so FindPython3 searches that version.
1616
execute_process(
1717
COMMAND
1818
"${_specified_Python3_EXECUTABLE}" -c
19-
"import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
19+
"import sys; print('{}.{}.{}'.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))"
2020
OUTPUT_VARIABLE _specified_Python3_VERSION_MM
2121
ERROR_VARIABLE _specified_Python3_VERSION_MM_ERR
2222
OUTPUT_STRIP_TRAILING_WHITESPACE

0 commit comments

Comments
 (0)