mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
247 lines
10 KiB
Diff
247 lines
10 KiB
Diff
Make FindPyKDE4 work with PyQt's new build system.
|
|
Make FindPyQt4 work with PyQt's new build system.
|
|
|
|
Since PyQt 4.10, PyQt.pyqtconfig is deprecated and not available unless
|
|
PyQt is built using the old configure script.
|
|
|
|
PyKDE4 itself has recently been adjusted to mimic PyQt itself and only
|
|
install its pykdeconfig module if pyqtconfig is present. Additionally,
|
|
information such as SIP flags and the directory where PyKDE's SIP files
|
|
are installed are now also provided in the
|
|
PyKDE4.kdecore.PYKDE_CONFIGURATION dict.
|
|
|
|
This commit completely rewrites FindPyKDE4.py to make it look like
|
|
FindPyQt.cmake after commit a7e4743: most of the information used by
|
|
FindPyKDE4.cmake is fetched from PyKDE4.kdecore, and we first try to
|
|
obtain the SIP flags and directory from pykdeconfig and, if it fails, we
|
|
use PYKDE_CONFIGURATION.
|
|
|
|
Furthermore, FindPyKDE4.py now only prints the variables that are
|
|
actually consumed by FindPyKDE4.cmake -- it is not possible to obtain
|
|
all the data provided by pykdeconfig in PYKDE_CONFIGURATION. We've also
|
|
stopped reading and setting PYKDE4_VERSION_TAG, since PyKDE4 stopped
|
|
setting a KDE tag in 2008 (and its value was 3_92_0 at the time).
|
|
|
|
CCBUG: 327633
|
|
REVIEW: 119454
|
|
|
|
BUG: 337462
|
|
FIXED-IN: 4.14.0
|
|
REVIEW: 119302
|
|
--- kdelibs-4.13.3/cmake/modules/FindPyKDE4.cmake~ 2014-08-06 21:54:27.564432282 +0000
|
|
+++ kdelibs-4.13.3/cmake/modules/FindPyKDE4.cmake 2014-08-06 21:54:43.417702615 +0000
|
|
@@ -25,7 +25,6 @@
|
|
STRING(REGEX REPLACE ".*\npykde_version_str:([^\n]+).*$" "\\1" PYKDE4_VERSION_STR ${pykde_config})
|
|
STRING(REGEX REPLACE ".*\npykde_kde_sip_flags:([^\n]+).*$" "\\1" PYKDE4_SIP_FLAGS ${pykde_config})
|
|
STRING(REGEX REPLACE ".*\npykde_sip_dir:([^\n]+).*$" "\\1" PYKDE4_SIP_DIR ${pykde_config})
|
|
- STRING(REGEX REPLACE ".*\npykde_version_tag:([^\n]+).*$" "\\1" PYKDE4_VERSION_TAG ${pykde_config})
|
|
MESSAGE(STATUS "Found PyKDE4 version ${PYKDE4_VERSION_STR} ${PYKDE4_SIP_DIR}")
|
|
|
|
SET(PYKDE4_FOUND TRUE)
|
|
@@ -183,3 +182,4 @@
|
|
endif(WIN32)
|
|
ENDMACRO(PYKDE4_ADD_EXECUTABLE)
|
|
|
|
+
|
|
--- kdelibs-4.13.3/cmake/modules/FindPyKDE4.py~ 2014-08-06 21:54:56.427650960 +0000
|
|
+++ kdelibs-4.13.3/cmake/modules/FindPyKDE4.py 2014-08-06 21:55:04.400952596 +0000
|
|
@@ -1,46 +1,23 @@
|
|
-# By Simon Edwards <simon@simonzone.com>
|
|
-# modified by Paul Giannaros <paul@giannaros.org> to add better PyKDE4
|
|
-# sip directory finding
|
|
-# This file is in the public domain.
|
|
+# Copyright (c) 2014, Raphael Kubo da Costa <rakuco@FreeBSD.org>
|
|
+# Redistribution and use is allowed according to the terms of the BSD license.
|
|
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
-import sys
|
|
-import os
|
|
-import PyKDE4.pykdeconfig
|
|
-import PyQt4.pyqtconfig
|
|
+import PyKDE4.kdecore
|
|
|
|
-if "_pkg_config" in dir(PyKDE4.pykdeconfig):
|
|
- _pkg_config = PyKDE4.pykdeconfig._pkg_config
|
|
+if __name__ == '__main__':
|
|
+ try:
|
|
+ import PyKDE4.pykdeconfig
|
|
+ pykdecfg = PyKDE4.pykdeconfig.Configuration()
|
|
+ sip_dir = pykdecfg.pykde_sip_dir
|
|
+ sip_flags = pykdecfg.pykde_kde_sip_flags
|
|
+ except ImportError:
|
|
+ # PyQt4 >= 4.10.0 was built with configure-ng.py instead of
|
|
+ # configure.py, so pyqtconfig.py and pykdeconfig.py are not installed.
|
|
+ sip_dir = PyKDE4.kdecore.PYKDE_CONFIGURATION['sip_dir']
|
|
+ sip_flags = PyKDE4.kdecore.PYKDE_CONFIGURATION['sip_flags']
|
|
|
|
- for varname in [
|
|
- 'kde_version',
|
|
- 'kde_version_extra',
|
|
- 'kdebasedir',
|
|
- 'kdeincdir',
|
|
- 'kdelibdir',
|
|
- 'libdir',
|
|
- 'pykde_kde_sip_flags',
|
|
- 'pykde_mod_dir',
|
|
- 'pykde_modules',
|
|
- 'pykde_sip_dir',
|
|
- 'pykde_version',
|
|
- 'pykde_version_str']:
|
|
- varvalue = _pkg_config[varname]
|
|
- if varname == 'pykde_sip_dir':
|
|
- d = os.path.join(_pkg_config[varname], 'PyKDE4')
|
|
- if os.path.exists(d):
|
|
- varvalue = d
|
|
- print("%s:%s\n" % (varname, varvalue))
|
|
- pykde_version_tag = ''
|
|
- in_t = False
|
|
- for item in _pkg_config['pykde_kde_sip_flags'].split():
|
|
- if item == "-t":
|
|
- in_t = True
|
|
- elif in_t:
|
|
- if item.startswith("KDE_"):
|
|
- pykde_version_tag = item
|
|
- else:
|
|
- in_t = False
|
|
- print("pykde_version_tag:%s" % pykde_version_tag)
|
|
+ print('pykde_version:%06.x' % PyKDE4.kdecore.version())
|
|
+ print('pykde_version_str:%s' % PyKDE4.kdecore.versionString())
|
|
+ print('pykde_sip_dir:%s' % sip_dir)
|
|
+ print('pykde_sip_flags:%s' % sip_flags)
|
|
|
|
-else:
|
|
- sys.exit(1)
|
|
--- kdelibs-4.13.3/cmake/modules/FindPyQt.py~ 2014-08-06 21:55:55.874081319 +0000
|
|
+++ kdelibs-4.13.3/cmake/modules/FindPyQt.py 2014-08-06 21:56:06.250706848 +0000
|
|
@@ -1,24 +1,49 @@
|
|
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
|
|
+# Copyright (c) 2014, Raphael Kubo da Costa <rakuco@FreeBSD.org>
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
-import PyQt4.pyqtconfig
|
|
+import PyQt4.QtCore
|
|
+import os
|
|
+import sys
|
|
|
|
-pyqtcfg = PyQt4.pyqtconfig.Configuration()
|
|
-print("pyqt_version:%06.0x" % pyqtcfg.pyqt_version)
|
|
-print("pyqt_version_str:%s" % pyqtcfg.pyqt_version_str)
|
|
-
|
|
-pyqt_version_tag = ""
|
|
-in_t = False
|
|
-for item in pyqtcfg.pyqt_sip_flags.split(' '):
|
|
- if item=="-t":
|
|
- in_t = True
|
|
- elif in_t:
|
|
- if item.startswith("Qt_4"):
|
|
- pyqt_version_tag = item
|
|
+def get_default_sip_dir():
|
|
+ # This is based on QScintilla's configure.py, and only works for the
|
|
+ # default case where installation paths have not been changed in PyQt's
|
|
+ # configuration process.
|
|
+ if sys.platform == 'win32':
|
|
+ pyqt_sip_dir = os.path.join(sys.prefix, 'sip', 'PyQt4')
|
|
else:
|
|
- in_t = False
|
|
-print("pyqt_version_tag:%s" % pyqt_version_tag)
|
|
+ pyqt_sip_dir = os.path.join(sys.prefix, 'share', 'sip', 'PyQt4')
|
|
+ return pyqt_sip_dir
|
|
+
|
|
+def get_qt4_tag(sip_flags):
|
|
+ in_t = False
|
|
+ for item in sip_flags.split(' '):
|
|
+ if item == '-t':
|
|
+ in_t = True
|
|
+ elif in_t:
|
|
+ if item.startswith('Qt_4'):
|
|
+ return item
|
|
+ else:
|
|
+ in_t = False
|
|
+ raise ValueError('Cannot find Qt\'s tag in PyQt4\'s SIP flags.')
|
|
+
|
|
+if __name__ == '__main__':
|
|
+ try:
|
|
+ import PyQt4.pyqtconfig
|
|
+ pyqtcfg = PyQt4.pyqtconfig.Configuration()
|
|
+ sip_dir = pyqtcfg.pyqt_sip_dir
|
|
+ sip_flags = pyqtcfg.pyqt_sip_flags
|
|
+ except ImportError:
|
|
+ # PyQt4 >= 4.10.0 was built with configure-ng.py instead of
|
|
+ # configure.py, so pyqtconfig.py is not installed.
|
|
+ sip_dir = get_default_sip_dir()
|
|
+ sip_flags = PyQt4.QtCore.PYQT_CONFIGURATION['sip_flags']
|
|
+
|
|
+ print('pyqt_version:%06.x' % PyQt4.QtCore.PYQT_VERSION)
|
|
+ print('pyqt_version_str:%s' % PyQt4.QtCore.PYQT_VERSION_STR)
|
|
+ print('pyqt_version_tag:%s' % get_qt4_tag(sip_flags))
|
|
+ print('pyqt_sip_dir:%s' % sip_dir)
|
|
+ print('pyqt_sip_flags:%s' % sip_flags)
|
|
|
|
-print("pyqt_sip_dir:%s" % pyqtcfg.pyqt_sip_dir)
|
|
-print("pyqt_sip_flags:%s" % pyqtcfg.pyqt_sip_flags)
|
|
--- kdelibs-4.13.3/cmake/modules/FindPyQt4.cmake~ 2014-08-06 21:55:16.697570407 +0000
|
|
+++ kdelibs-4.13.3/cmake/modules/FindPyQt4.cmake 2014-08-06 21:55:38.597483393 +0000
|
|
@@ -9,16 +9,20 @@
|
|
# Find the installed version of PyQt4. FindPyQt4 should only be called after
|
|
# Python has been found.
|
|
#
|
|
-# This file defines the following variables:
|
|
+# This file defines the following variables, which can also be overriden by
|
|
+# users:
|
|
#
|
|
# PYQT4_VERSION - The version of PyQt4 found expressed as a 6 digit hex number
|
|
# suitable for comparison as a string
|
|
#
|
|
# PYQT4_VERSION_STR - The version of PyQt4 as a human readable string.
|
|
#
|
|
-# PYQT4_VERSION_TAG - The PyQt version tag using by PyQt's sip files.
|
|
+# PYQT4_VERSION_TAG - The Qt4 version tag used by PyQt's sip files.
|
|
#
|
|
-# PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files.
|
|
+# PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files. This can be unset
|
|
+# if PyQt4 was built using its new build system and pyqtconfig.py is not
|
|
+# present on the system, as in this case its value cannot be determined
|
|
+# automatically.
|
|
#
|
|
# PYQT4_SIP_FLAGS - The SIP flags used to build PyQt.
|
|
|
|
@@ -31,13 +35,27 @@
|
|
|
|
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_pyqt_py} OUTPUT_VARIABLE pyqt_config)
|
|
IF(pyqt_config)
|
|
- STRING(REGEX REPLACE "^pyqt_version:([^\n]+).*$" "\\1" PYQT4_VERSION ${pyqt_config})
|
|
- STRING(REGEX REPLACE ".*\npyqt_version_str:([^\n]+).*$" "\\1" PYQT4_VERSION_STR ${pyqt_config})
|
|
- STRING(REGEX REPLACE ".*\npyqt_version_tag:([^\n]+).*$" "\\1" PYQT4_VERSION_TAG ${pyqt_config})
|
|
- STRING(REGEX REPLACE ".*\npyqt_sip_dir:([^\n]+).*$" "\\1" PYQT4_SIP_DIR ${pyqt_config})
|
|
- STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT4_SIP_FLAGS ${pyqt_config})
|
|
+ STRING(REGEX MATCH "^pyqt_version:([^\n]+).*$" _dummy ${pyqt_config})
|
|
+ SET(PYQT4_VERSION "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a 6-digit hexadecimal number")
|
|
|
|
- SET(PYQT4_FOUND TRUE)
|
|
+ STRING(REGEX MATCH ".*\npyqt_version_str:([^\n]+).*$" _dummy ${pyqt_config})
|
|
+ SET(PYQT4_VERSION_STR "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a human-readable string")
|
|
+
|
|
+ STRING(REGEX MATCH ".*\npyqt_version_tag:([^\n]+).*$" _dummy ${pyqt_config})
|
|
+ SET(PYQT4_VERSION_TAG "${CMAKE_MATCH_1}" CACHE STRING "The Qt4 version tag used by PyQt4's .sip files")
|
|
+
|
|
+ STRING(REGEX MATCH ".*\npyqt_sip_dir:([^\n]+).*$" _dummy ${pyqt_config})
|
|
+ SET(PYQT4_SIP_DIR "${CMAKE_MATCH_1}" CACHE PATH "The base directory where PyQt4's .sip files are installed")
|
|
+
|
|
+ STRING(REGEX MATCH ".*\npyqt_sip_flags:([^\n]+).*$" _dummy ${pyqt_config})
|
|
+ SET(PYQT4_SIP_FLAGS "${CMAKE_MATCH_1}" CACHE STRING "The SIP flags used to build PyQt4")
|
|
+
|
|
+ IF(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}")
|
|
+ MESSAGE(WARNING "The base directory where PyQt4's SIP files are installed could not be determined. This usually means PyQt4 was built with its new build system and pyqtconfig.py is not present.\n"
|
|
+ "Please set the PYQT4_SIP_DIR variable manually.")
|
|
+ ELSE(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}")
|
|
+ SET(PYQT4_FOUND TRUE)
|
|
+ ENDIF(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}")
|
|
ENDIF(pyqt_config)
|
|
|
|
IF(PYQT4_FOUND)
|
|
@@ -51,3 +69,4 @@
|
|
ENDIF(PYQT4_FOUND)
|
|
|
|
ENDIF(EXISTS PYQT4_VERSION)
|
|
+
|