From c0e175be5ed71d7837bd29f40fa1f2c46269c5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Tue, 14 Sep 2021 18:00:03 +0200 Subject: [PATCH] Prefer Debian's default Python 3 version in FindPython.cmake Closes: #945825 --- ...fer-Debian-default-version-of-Python.patch | 33 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 34 insertions(+) create mode 100644 debian/patches/0002-Prefer-Debian-default-version-of-Python.patch diff --git a/debian/patches/0002-Prefer-Debian-default-version-of-Python.patch b/debian/patches/0002-Prefer-Debian-default-version-of-Python.patch new file mode 100644 index 000000000..12856d66f --- /dev/null +++ b/debian/patches/0002-Prefer-Debian-default-version-of-Python.patch @@ -0,0 +1,33 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Mon, 13 Sep 2021 18:59:25 +0200 +Subject: Prefer Debian default version of Python + +--- + Modules/FindPython/Support.cmake | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake +index 8e70e11..828e075 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() diff --git a/debian/patches/series b/debian/patches/series index 4492477b2..08d96a889 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 0001-Fix-cross-compilation-with-MPI.patch +0002-Prefer-Debian-default-version-of-Python.patch