dev-python/python-poppler-qt4: Clean old versions up

This commit is contained in:
Michał Górny
2017-05-02 10:03:48 +02:00
parent fc3e537322
commit 577942e28f
3 changed files with 0 additions and 212 deletions

View File

@@ -1,2 +1 @@
DIST python-poppler-qt4-0.18.1.tar.gz 15555 SHA256 c6903c4b6ab71730ae2a1da9fb95830a83da82185b5ef6b8184b16c0cae908ba SHA512 f1451e3b60cb51eb3c07d906144ecff2a2737b68018645390441b2eb4942450e2e836a3e20d926c82a7536ae7b3963f7a869a5d7a3274befde7d01144b116a44 WHIRLPOOL 2ef090817a78baa1b55997baf4e6eb61aa21e6d064826bfc14db27e145a477d3b3ff28b6f10076cade979e9f1634cfbe43e3bee51d841d4ea4fbd72cddcd6ce4
DIST python-poppler-qt4-0.24.0.tar.gz 17452 SHA256 164297bcb03dc0cd943342915bf49e678db13957ebc2f1f3bd988f04145fb236 SHA512 5f03e85f80f2ed4d560ee001a1c0394ddb2ccde504bf8564ceb700af27df8ed41de9fd60e058ce72e32d8ea37cb7706446f0793b25d8475803956653b82e593d WHIRLPOOL 8c242951c47d7552cdf61c55b5074ecc600efe52cc948ea96cab5c06d39f6d2beb72cdd642bb5dfde89952e3799691b0911dd86bdc46e4107f07e96986b3984a

View File

@@ -1,185 +0,0 @@
From 099924f9b359b82696e3aa9f159616ff09d2da97 Mon Sep 17 00:00:00 2001
From: Philip Lorenz <philip@bithub.de>
Date: Tue, 8 Jul 2014 18:23:49 +0200
Subject: [PATCH 3/3] Support PyQt's "new" build system
PyQt4 ships with a configure.py and configure-ng.py script for
configuration. The former produced the "pyqtconfig" module which was
used to determine various flags required for compilation of
python-poppler-qt4. The configure.py script has been causing some issues
([1]) and upstream suggests to use configure-ng.py instead as the old
configuration script is deprecated ([2]).
This patch adapts setup.py to work without the "pyqtconfig" module by
looking up the required config values via the new mechanisms endorsed by
upstream. Additionally, it adds the --qt-include-dir, --pyqt-sip-dir,
--pyqt-sip-flags command line arguments to the "build_ext" command which
can be used to set those values manually.
[1] http://www.riverbankcomputing.com/pipermail/pyqt/2014-June/034344.html
[2] http://www.riverbankcomputing.com/pipermail/pyqt/2014-June/034354.html
---
setup.py | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 94 insertions(+), 20 deletions(-)
diff --git a/setup.py b/setup.py
index 56f3e3f..c43c5e4 100644
--- a/setup.py
+++ b/setup.py
@@ -56,14 +56,6 @@ except ImportError:
pass
### end
-import PyQt4.pyqtconfig
-config = PyQt4.pyqtconfig.Configuration()
-
-pyqt_sip_dir = config.pyqt_sip_dir
-pyqt_sip_flags = config.pyqt_sip_flags
-qt_inc_dir = config.qt_inc_dir
-
-
def pkg_config(package, attrs=None, include_only=False):
"""parse the output of pkg-config for a package.
@@ -107,17 +99,8 @@ def pkg_config_version(package):
return tuple(map(int, re.findall(r'\d+', output)))
except OSError:
sys.stderr.write("Can't determine version of %s\n" % package)
-
-
-ext_args = {
- 'include_dirs': [
- qt_inc_dir,
- os.path.join(qt_inc_dir, 'QtCore'),
- os.path.join(qt_inc_dir, 'QtGui'),
- os.path.join(qt_inc_dir, 'QtXml'),
- ],
-}
+ext_args = {}
pkg_config('poppler-qt4', ext_args)
if 'libraries' not in ext_args:
@@ -131,17 +114,108 @@ class build_ext(build_ext_base):
user_options = build_ext_base.user_options + [
('poppler-version=', None, "version of the poppler library"),
+ ('qmake-bin=', None, "Path to qmake binary"),
+ ('qt-include-dir=', None, "Path to Qt headers"),
+ ('pyqt-sip-dir=', None, "Path to PyQt's SIP files"),
+ ('pyqt-sip-flags=', None, "SIP flags used to generate PyQt bindings")
]
def initialize_options (self):
build_ext_base.initialize_options(self)
self.poppler_version = None
+ self.qmake_bin = 'qmake'
+
+ self.qt_include_dir = None
+ self.pyqt_sip_dir = None
+ self.pyqt_sip_flags = None
+
def finalize_options (self):
build_ext_base.finalize_options(self)
+
+ if not self.qt_include_dir:
+ self.qt_include_dir = self.__find_qt_include_dir()
+
+ if not self.pyqt_sip_dir:
+ self.pyqt_sip_dir = self.__find_pyqt_sip_dir()
+
+ if not self.pyqt_sip_flags:
+ self.pyqt_sip_flags = self.__find_pyqt_sip_flags()
+
+ if not self.qt_include_dir:
+ raise SystemExit('Could not find Qt4 headers. '
+ 'Please specify via --qt-include-dir=')
+
+ if not self.pyqt_sip_dir:
+ raise SystemExit('Could not find PyQt SIP files. '
+ 'Please specify containing directory via '
+ '--pyqt-sip-dir=')
+
+ if not self.pyqt_sip_flags:
+ raise SystemExit('Could not find PyQt SIP flags. '
+ 'Please specify via --pyqt-sip-flags=')
+
+ self.include_dirs += (self.qt_include_dir,
+ os.path.join(self.qt_include_dir, 'QtCore'),
+ os.path.join(self.qt_include_dir, 'QtGui'),
+ os.path.join(self.qt_include_dir, 'QtXml'))
+
if self.poppler_version is not None:
self.poppler_version = tuple(map(int, re.findall(r'\d+', self.poppler_version)))
+ def __find_qt_include_dir(self):
+ if self.pyqtconfig:
+ return self.pyqtconfig.qt_inc_dir
+
+ try:
+ qt_version = subprocess.check_output([self.qmake_bin,
+ '-query',
+ 'QT_VERSION'])
+ qt_version = qt_version.strip().decode("ascii")
+ except (OSError, subprocess.CalledProcessError) as e:
+ raise SystemExit('Failed to determine Qt version (%s).' % e)
+
+ if not qt_version.startswith("4."):
+ raise SystemExit('Unsupported Qt version (%s). '
+ 'Try specifying the path to qmake manually via '
+ '--qmake-bin=' % qt_version)
+
+ try:
+ result = subprocess.check_output([self.qmake_bin,
+ '-query',
+ 'QT_INSTALL_HEADERS'])
+ return result.strip().decode(sys.getfilesystemencoding())
+ except (OSError, subprocess.CalledProcessError) as e:
+ raise SystemExit('Failed to determine location of Qt headers (%s).' % e)
+
+ def __find_pyqt_sip_dir(self):
+ if self.pyqtconfig:
+ return self.pyqtconfig.pyqt_sip_dir
+
+ import sipconfig
+
+ return os.path.join(sipconfig.Configuration().default_sip_dir, 'PyQt4')
+
+ def __find_pyqt_sip_flags(self):
+ if self.pyqtconfig:
+ return self.pyqtconfig.pyqt_sip_flags
+
+ from PyQt4 import QtCore
+
+ return QtCore.PYQT_CONFIGURATION.get('sip_flags', '')
+
+ @property
+ def pyqtconfig(self):
+ if not hasattr(self, '_pyqtconfig'):
+ try:
+ from PyQt4 import pyqtconfig
+
+ self._pyqtconfig = pyqtconfig.Configuration()
+ except ImportError:
+ self._pyqtconfig = None
+
+ return self._pyqtconfig
+
def _sip_compile(self, sip_bin, source, sbf):
# Disable features if older poppler-qt4 version is found.
@@ -176,8 +250,8 @@ class build_ext(build_ext_base):
cmd += [
"-c", self.build_temp,
"-b", sbf,
- "-I", pyqt_sip_dir] # find the PyQt4 stuff
- cmd += shlex.split(pyqt_sip_flags) # use same SIP flags as for PyQt4
+ "-I", self.pyqt_sip_dir] # find the PyQt4 stuff
+ cmd += shlex.split(self.pyqt_sip_flags) # use same SIP flags as for PyQt4
cmd.append(source)
self.spawn(cmd)
--
2.0.2

View File

@@ -1,26 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python{2_7,3_4} )
inherit distutils-r1 eutils
DESCRIPTION="A python binding for libpoppler-qt4"
HOMEPAGE="https://github.com/wbsoft/python-poppler-qt4"
SRC_URI="https://github.com/wbsoft/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
RDEPEND="app-text/poppler:=[qt4]
dev-python/PyQt4[${PYTHON_USEDEP}]
>=dev-python/sip-4.9.1[${PYTHON_USEDEP}]"
DEPEND="${RDEPEND}"
src_prepare() {
epatch "${FILESDIR}"/${P}-update_for_new_PyQt4_build.patch
distutils-r1_src_prepare
}