You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.4 KiB
35 lines
1.4 KiB
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
|
|
Date: Mon, 13 Sep 2021 18:59:25 +0200
|
|
Subject: Prefer Debian default version of Python
|
|
|
|
Forwarded: not-needed
|
|
---
|
|
Modules/FindPython/Support.cmake | 14 ++++++++++++++
|
|
1 file changed, 14 insertions(+)
|
|
|
|
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
|
|
index ce25cfc..df5ea06 100644
|
|
--- a/Modules/FindPython/Support.cmake
|
|
+++ b/Modules/FindPython/Support.cmake
|
|
@@ -23,6 +23,20 @@ if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
|
|
endif()
|
|
if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3")
|
|
set(_${_PYTHON_PREFIX}_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
|
+ # Debian-specific: prefer current default version
|
|
+ execute_process(
|
|
+ COMMAND py3versions -vd
|
|
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_DEFAULT_VERSION
|
|
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_DEFAULT_RESULT
|
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
+ ERROR_QUIET
|
|
+ )
|
|
+ if(NOT _${_PYTHON_PREFIX}_DEFAULT_RESULT)
|
|
+ list(REMOVE_ITEM _${_PYTHON_PREFIX}_VERSIONS ${_${_PYTHON_PREFIX}_DEFAULT_VERSION})
|
|
+ list(INSERT _${_PYTHON_PREFIX}_VERSIONS 0 ${_${_PYTHON_PREFIX}_DEFAULT_VERSION})
|
|
+ endif()
|
|
+ unset(_${_PYTHON_PREFIX}_DEFAULT_RESULT)
|
|
+ unset(_${_PYTHON_PREFIX}_DEFAULT_VERSION)
|
|
elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "2")
|
|
set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
|
else()
|