From 9b5a41a7c2181eaf2c173f8a913c12cc3edf57f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Wasserb=C3=A4ch?= Date: Mon, 7 Jun 2010 16:50:46 +0200 Subject: [PATCH] Incorporate ideas from Modestas into the Python patch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modestas had a few very good ideas on how to improve the patch I've introduced with a previous commit. This patch incorporates them. Signed-off-by: Kai Wasserbäch --- debian/README.Debian | 13 +++++ debian/cmake-data.NEWS | 14 ----- .../FindPython_fix_#569321_and_#580503.diff | 56 +++++++++++-------- 3 files changed, 46 insertions(+), 37 deletions(-) create mode 100644 debian/README.Debian delete mode 100644 debian/cmake-data.NEWS diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 000000000..c08e6dd67 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,13 @@ +Changes in behaviour of FindPython{Interp,Libs} +=============================================== + +If you're a user of the FindPythonInterp.cmake or FindPythonLibs.cmake script be +advised, that there is a change in its behaviour. From the 2.8.1-6 package +onwards the Debian version of these scripts will act like the following: + 1. If you've defined CMAKE_USE_PYTHON_VERSION with a specific version, say + 2.6, the script will only check for the requested version. + 2. If no version was requested, we'll try to find the default Python version + for Debian and return that information. Failing that, a list of versions is + tried until either one version was found or the search finally failed. + + -- Kai Wasserbäch Mon, 07 Jun 2010 13:52:38 +0200 diff --git a/debian/cmake-data.NEWS b/debian/cmake-data.NEWS deleted file mode 100644 index 23ab9f458..000000000 --- a/debian/cmake-data.NEWS +++ /dev/null @@ -1,14 +0,0 @@ -Changes in behaviour of FindPython{Interp,Libs} -=============================================== - -If you're a user of the FindPythonInterp.cmake or FindPythonLibs.cmake script be -advised, that there is a change in its behaviour. From the 2.8.1-6 package -onwards the Debian version of these scripts will act like the following: - 1. If you've defined CMAKE_PYTHON_VERSION with a specific version, say 2.6, - the script will only check for the requested version. - 2. If no version was requested, we'll try to find the defaul Python version - for Debian and return that information. - 3. If you want the old behaviour (return the latest version), then you'll - need to set NO_DEBIAN_PY_DEFAULT to true before calling either script. - - -- Kai Wasserbäch Thu, 03 Jun 2010 15:15:59 +0200 diff --git a/debian/patches/FindPython_fix_#569321_and_#580503.diff b/debian/patches/FindPython_fix_#569321_and_#580503.diff index 91bdcd5cc..2ab681486 100644 --- a/debian/patches/FindPython_fix_#569321_and_#580503.diff +++ b/debian/patches/FindPython_fix_#569321_and_#580503.diff @@ -8,13 +8,13 @@ Description: Make the Python CMake scripts more versatile in version handling. Parts of this patch were sent upstream (the "request a specific version" part). The part for requesting a specific version was written by Didier Raboud . -Last-Update: 2010-06-03 +Last-Update: 2010-06-07 Origin: vendor Forwarded: yes --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake -@@ -19,19 +19,30 @@ +@@ -19,19 +19,35 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) @@ -36,17 +36,22 @@ Forwarded: yes +# Didier Raboud and Jakub Wilk to fix the +# following bugs: #569321 and #580503. +# For further information please see the Debian.NEWS file for cmake-data. -+IF(CMAKE_PYTHON_VERSION) -+ SET(CMAKE_PYTHON_VERSIONS ${CMAKE_PYTHON_VERSION}) -+ELSE(CMAKE_PYTHON_VERSION) -+ IF(NO_DEBIAN_PY_DEFAULT) -+ SET(CMAKE_PYTHON_VERSIONS 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) -+ ELSE(NO_DEBIAN_PY_DEFAULT) ++IF(CMAKE_USE_PYTHON_VERSION) ++ SET(CMAKE_PYTHON_VERSIONS ${CMAKE_USE_PYTHON_VERSION}) ++ELSE(CMAKE_USE_PYTHON_VERSION) ++ SET(CMAKE_PYTHON_VERSIONS 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) ++ ++ FIND_PROGRAM(PYVERSIONS_EXE ++ NAMES pyversions ++ ) ++ IF(PYVERSIONS_EXE) + EXECUTE_PROCESS(COMMAND pyversions -dv -+ OUTPUT_VARIABLE _CMAKE_PYTHON_VERSIONS) -+ STRING(REPLACE "\n" "" CMAKE_PYTHON_VERSIONS ${_CMAKE_PYTHON_VERSIONS}) -+ ENDIF(NO_DEBIAN_PY_DEFAULT) -+ENDIF(CMAKE_PYTHON_VERSION) ++ OUTPUT_VARIABLE _CMAKE_PYTHON_VERSIONS ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++ LIST(INSERT CMAKE_PYTHON_VERSIONS 0 ${_CMAKE_PYTHON_VERSIONS}) ++ LIST(REMOVE_DUPLICATES CMAKE_PYTHON_VERSIONS) ++ ENDIF(PYVERSIONS_EXE) ++ENDIF(CMAKE_USE_PYTHON_VERSION) + +FOREACH(_CURRENT_VERSION ${CMAKE_PYTHON_VERSIONS}) + FIND_PROGRAM(PYTHON_EXECUTABLE @@ -60,7 +65,7 @@ Forwarded: yes # all listed variables are TRUE --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake -@@ -27,7 +27,24 @@ INCLUDE(CMakeFindFrameworks) +@@ -27,7 +27,29 @@ INCLUDE(CMakeFindFrameworks) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) @@ -70,17 +75,22 @@ Forwarded: yes +# Didier Raboud and Jakub Wilk to fix the +# following bugs: #569321 and #580503. +# For further information please see the Debian.NEWS file for cmake-data. -+IF(CMAKE_PYTHON_VERSION) -+ SET(CMAKE_PYTHON_VERSIONS ${CMAKE_PYTHON_VERSION}) -+ELSE(CMAKE_PYTHON_VERSION) -+ IF(NO_DEBIAN_PY_DEFAULT) -+ SET(CMAKE_PYTHON_VERSIONS 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) -+ ELSE(NO_DEBIAN_PY_DEFAULT) ++IF(CMAKE_USE_PYTHON_VERSION) ++ SET(CMAKE_PYTHON_VERSIONS ${CMAKE_USE_PYTHON_VERSION}) ++ELSE(CMAKE_USE_PYTHON_VERSION) ++ SET(CMAKE_PYTHON_VERSIONS 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) ++ ++ FIND_PROGRAM(PYVERSIONS_EXE ++ NAMES pyversions ++ ) ++ IF(PYVERSIONS_EXE) + EXECUTE_PROCESS(COMMAND pyversions -dv -+ OUTPUT_VARIABLE _CMAKE_PYTHON_VERSIONS) -+ STRING(REPLACE "\n" "" CMAKE_PYTHON_VERSIONS ${_CMAKE_PYTHON_VERSIONS}) -+ ENDIF(NO_DEBIAN_PY_DEFAULT) -+ENDIF(CMAKE_PYTHON_VERSION) ++ OUTPUT_VARIABLE _CMAKE_PYTHON_VERSIONS ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++ LIST(INSERT CMAKE_PYTHON_VERSIONS 0 ${_CMAKE_PYTHON_VERSIONS}) ++ LIST(REMOVE_DUPLICATES CMAKE_PYTHON_VERSIONS) ++ ENDIF(PYVERSIONS_EXE) ++ENDIF(CMAKE_USE_PYTHON_VERSION) + +FOREACH(_CURRENT_VERSION ${CMAKE_PYTHON_VERSIONS}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})