2022-11-17 21:07:46 +01:00
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
2022-11-24 21:44:14 +01:00
Date: Thu, 24 Nov 2022 21:40:09 +0100
2022-11-17 21:07:46 +01:00
Subject: Prefer default Python version
2022-11-24 21:44:14 +01:00
This patch prefers /usr/bin/python3 as interpreter over all others,
subject to version restrictions. CMP0094 is forced to the NEW
behavior, because the OLD behavior will always end up with the newest
installed Python version.
2022-11-17 21:07:46 +01:00
Forwarded: not-needed
---
2022-11-24 21:44:14 +01:00
Modules/FindPython/Support.cmake | 9 ++-------
2022-11-17 21:07:46 +01:00
Modules/FindPythonInterp.cmake | 1 +
2022-11-24 21:44:14 +01:00
2 files changed, 3 insertions(+), 7 deletions(-)
2022-11-17 21:07:46 +01:00
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
2024-09-30 00:17:56 +02:00
index faca5ae..f46a78f 100644
2022-11-17 21:07:46 +01:00
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
2024-09-30 00:17:56 +02:00
@@ -1533,12 +1533,7 @@ unset (${_PYTHON_PREFIX}_SOSABI)
2024-07-09 14:47:59 +02:00
unset (${_PYTHON_PREFIX}_DEBUG_POSTFIX)
2022-11-24 21:44:14 +01:00
# Define lookup strategy
-cmake_policy (GET CMP0094 _${_PYTHON_PREFIX}_LOOKUP_POLICY)
-if (_${_PYTHON_PREFIX}_LOOKUP_POLICY STREQUAL "NEW")
- set (_${_PYTHON_PREFIX}_FIND_STRATEGY "LOCATION")
-else()
- set (_${_PYTHON_PREFIX}_FIND_STRATEGY "VERSION")
-endif()
+set (_${_PYTHON_PREFIX}_FIND_STRATEGY "LOCATION")
if (DEFINED ${_PYTHON_PREFIX}_FIND_STRATEGY)
if (NOT ${_PYTHON_PREFIX}_FIND_STRATEGY MATCHES "^(VERSION|LOCATION)$")
message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_STRATEGY}: invalid value for '${_PYTHON_PREFIX}_FIND_STRATEGY'. 'VERSION' or 'LOCATION' expected.")
2024-09-30 00:17:56 +02:00
@@ -1738,7 +1733,7 @@ if (DEFINED ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES)
2022-11-17 21:07:46 +01:00
set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES ${${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES})
endif()
else()
- set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST)
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES FIRST)
endif()
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
2023-08-21 10:28:23 +02:00
index 443c6eb..aed0873 100644
2022-11-17 21:07:46 +01:00
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
2023-07-02 19:57:17 +02:00
@@ -107,6 +107,7 @@ if(DEFINED PYTHONLIBS_VERSION_STRING)
2022-11-17 21:07:46 +01:00
endif()
# Search for the current active python version first
list(APPEND _Python_VERSIONS ";")
+list(APPEND _Python_VERSIONS "3")
list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS)