aboutsummaryrefslogtreecommitdiff
path: root/attic
diff options
context:
space:
mode:
authorRaphael Kubo da Costa <rakuco@FreeBSD.org>2014-07-29 20:33:45 +0300
committerRaphael Kubo da Costa <rakuco@FreeBSD.org>2014-07-29 20:33:45 +0300
commit3e56cadc9e7bb446772c9dc8ae9feea219a0929d (patch)
treea752c8f5cad88fd2f452f1820f0cc11d44622f70 /attic
parent3f375beaf555ceba66b869089e1a56f11b12a217 (diff)
downloadextra-cmake-modules-3e56cadc9e7bb446772c9dc8ae9feea219a0929d.tar.gz
extra-cmake-modules-3e56cadc9e7bb446772c9dc8ae9feea219a0929d.tar.bz2
Make FindPyKDE4 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). (Forwardport kdelibs 4d29cf8)
Diffstat (limited to 'attic')
-rw-r--r--attic/modules/FindPyKDE4.cmake1
-rw-r--r--attic/modules/FindPyKDE4.py62
2 files changed, 19 insertions, 44 deletions
diff --git a/attic/modules/FindPyKDE4.cmake b/attic/modules/FindPyKDE4.cmake
index 98f7c374..3b879636 100644
--- a/attic/modules/FindPyKDE4.cmake
+++ b/attic/modules/FindPyKDE4.cmake
@@ -25,7 +25,6 @@ IF(PYTHONINTERP_FOUND)
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)
diff --git a/attic/modules/FindPyKDE4.py b/attic/modules/FindPyKDE4.py
index e436c2a9..7916aa60 100644
--- a/attic/modules/FindPyKDE4.py
+++ b/attic/modules/FindPyKDE4.py
@@ -1,46 +1,22 @@
-# 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)
-
-else:
- sys.exit(1)
+ 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)