Control: tags -1 + patch
Here's what I did to get qgis to build in Ubuntu.
Apparently there's a new upstream release of qgis coming soon (that I
got one of the patches from).
SR
--
Stefano Rivera
http://tumbleweed.org.za/
H: +27 21 465 6908 C: +27 72 419 8559 UCT: x3127
Description: Update FindPythonLibrary to the version in kde4libs 4:4.10.5-1
Fixes FTBFS with multi-arched Python
Author: Stefano Rivera stefa...@ubuntu.com
Bug-Debian: http://bugs.debian.org/713358
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1010508
Forwarded: no
--- a/cmake/FindPythonLibrary.cmake
+++ b/cmake/FindPythonLibrary.cmake
@@ -12,6 +12,11 @@
# PYTHON_LONG_VERSION - The version of the Python interpreter found as a human
# readable string.
#
+# PYTHON_SITE_PACKAGES_INSTALL_DIR - this cache variable can be used for installing
+# own python modules. You may want to adjust this to be the
+# same as ${PYTHON_SITE_PACKAGES_DIR}, but then admin
+# privileges may be required for installation.
+#
# PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory.
#
# PYTHON_INCLUDE_PATH - Directory holding the python.h include file.
@@ -19,76 +24,50 @@
# PYTHON_LIBRARY, PYTHON_LIBRARIES- Location of the Python library.
# Copyright (c) 2007, Simon Edwards si...@simonzone.com
+# Copyright (c) 2012, Luca Beltrame lbeltr...@kde.org
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+include(FindPackageHandleStandardArgs)
+
+find_package(PythonInterp)
+
+if (PYTHONINTERP_FOUND)
+
+option(INSTALL_PYTHON_FILES_IN_PYTHON_PREFIX Install the Python files in the Python packages dir FALSE)
+
+# Set the Python libraries to what we actually found for interpreters
+set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+# These are kept for compatibility
+set(PYTHON_SHORT_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+set(PYTHON_LONG_VERSION ${PYTHON_VERSION_STRING})
+
+find_package(PythonLibs QUIET)
+
+if(PYTHONLIBS_FOUND)
+set(PYTHON_LIBRARY ${PYTHON_LIBRARIES})
+endif(PYTHONLIBS_FOUND)
+
+# Auto detect Python site-packages directory
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c from distutils.sysconfig import get_python_lib; print(get_python_lib(True))
+OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+message(STATUS Python system site-packages directory: ${PYTHON_SITE_PACKAGES_DIR})
+if(INSTALL_PYTHON_FILES_IN_PYTHON_PREFIX)
+set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${PYTHON_SITE_PACKAGES_DIR})
+else()
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c from distutils.sysconfig import get_python_lib; print(get_python_lib(True, prefix='${CMAKE_INSTALL_PREFIX}'))
+OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_INSTALL_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+endif()
-INCLUDE(CMakeFindFrameworks)
+if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR STREQUAL PYTHON_SITE_PACKAGES_DIR)
+message(STATUS The Python files will be installed to ${PYTHON_SITE_PACKAGES_INSTALL_DIR}. Make sure to add them to the Python search path (e.g. by setting PYTHONPATH))
+endif()
-if(EXISTS PYTHON_LIBRARY)
- # Already in cache, be silent
- set(PYTHONLIBRARY_FOUND TRUE)
-else(EXISTS PYTHON_LIBRARY)
-
- FIND_PACKAGE(PythonInterp)
-
- if(PYTHONINTERP_FOUND)
-
-FIND_FILE(_find_lib_python_py FindLibPython.py PATHS ${CMAKE_MODULE_PATH})
-
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_lib_python_py} OUTPUT_VARIABLE python_config)
-if(python_config)
- STRING(REGEX REPLACE .*exec_prefix:([^\n]+).*$ \\1 PYTHON_PREFIX ${python_config})
- STRING(REGEX REPLACE .*\nshort_version:([^\n]+).*$ \\1 PYTHON_SHORT_VERSION ${python_config})
- STRING(REGEX REPLACE .*\nlong_version:([^\n]+).*$ \\1 PYTHON_LONG_VERSION ${python_config})
- STRING(REGEX REPLACE .*\npy_inc_dir:([^\n]+).*$ \\1 PYTHON_INCLUDE_PATH ${python_config})
- if(NOT PYTHON_SITE_PACKAGES_DIR)
-if(NOT PYTHON_LIBS_WITH_KDE_LIBS)
- STRING(REGEX REPLACE .*\nsite_packages_dir:([^\n]+).*$ \\1 PYTHON_SITE_PACKAGES_DIR ${python_config})
-else(NOT PYTHON_LIBS_WITH_KDE_LIBS)
- set(PYTHON_SITE_PACKAGES_DIR ${KDE4_LIB_INSTALL_DIR}/python${PYTHON_SHORT_VERSION}/site-packages)
-endif(NOT PYTHON_LIBS_WITH_KDE_LIBS)
- endif(NOT PYTHON_SITE_PACKAGES_DIR)
- STRING(REGEX REPLACE ([0-9]+).([0-9]+) \\1\\2 PYTHON_SHORT_VERSION_NO_DOT ${PYTHON_SHORT_VERSION})
- set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} python${PYTHON_SHORT_VERSION_NO_DOT})
- if(WIN32)
- STRING(REPLACE \\ / PYTHON_SITE_PACKAGES_DIR ${PYTHON_SITE_PACKAGES_DIR})
- endif