summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-06-09 09:08:47 +0200
committerMichał Górny <mgorny@gentoo.org>2020-06-09 09:09:09 +0200
commitad20297abb44b98b63c188090db6dcdb9d49faa2 (patch)
tree0f7d83b88b6b465d917a2e1c8232dc62dbc2ef48
parentdev-python/ipython: Add doc-dep on matplotlib (diff)
downloadgentoo-ad20297abb44b98b63c188090db6dcdb9d49faa2.tar.gz
gentoo-ad20297abb44b98b63c188090db6dcdb9d49faa2.tar.bz2
gentoo-ad20297abb44b98b63c188090db6dcdb9d49faa2.zip
dev-python/pyperclip: Fix wrong checks for PyQt*
Closes: https://bugs.gentoo.org/727588 Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--dev-python/pyperclip/files/pyperclip-1.7.0-test-pyqt.patch33
-rw-r--r--dev-python/pyperclip/pyperclip-1.7.0.ebuild17
2 files changed, 50 insertions, 0 deletions
diff --git a/dev-python/pyperclip/files/pyperclip-1.7.0-test-pyqt.patch b/dev-python/pyperclip/files/pyperclip-1.7.0-test-pyqt.patch
new file mode 100644
index 000000000000..4f1a94955f44
--- /dev/null
+++ b/dev-python/pyperclip/files/pyperclip-1.7.0-test-pyqt.patch
@@ -0,0 +1,33 @@
+From be59ac638e26aff5204a32333f7ebe046003065a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2020 08:46:46 +0200
+Subject: [PATCH] Make PyQt checks in tests more specific
+
+Test whether the widgets module can be imported rather than 'PyQt?'
+in general. The latter gives false positives if PyQt is uninstalled
+but there are leftover subpackages such as qscintilla. In this case,
+Python 3 imports 'PyQt?' as a namespace.
+---
+ tests/test_pyperclip.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/test_pyperclip.py b/tests/test_pyperclip.py
+index 7519d94..2942639 100644
+--- a/tests/test_pyperclip.py
++++ b/tests/test_pyperclip.py
+@@ -146,10 +146,10 @@ class TestGtk(_TestClipboard):
+ class TestQt(_TestClipboard):
+ if HAS_DISPLAY:
+ try:
+- import PyQt5
++ import PyQt5.QtWidgets
+ except ImportError:
+ try:
+- import PyQt4
++ import PyQt4.QtGui
+ except ImportError:
+ pass
+ else:
+--
+2.27.0
+
diff --git a/dev-python/pyperclip/pyperclip-1.7.0.ebuild b/dev-python/pyperclip/pyperclip-1.7.0.ebuild
index 8ae4348d65c1..83e29c1235ef 100644
--- a/dev-python/pyperclip/pyperclip-1.7.0.ebuild
+++ b/dev-python/pyperclip/pyperclip-1.7.0.ebuild
@@ -19,8 +19,25 @@ RDEPEND="
x11-misc/xclip
x11-misc/xsel
dev-python/PyQt5[${PYTHON_USEDEP}]
+ dev-python/QtPy[${PYTHON_USEDEP}]
)
"
+# test at least one backend
+BDEPEND="
+ test? (
+ ${RDEPEND}
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-test-pyqt.patch
+)
+
+src_prepare() {
+ # stupid windows
+ find -type f -exec sed -i -e 's:\r$::' {} + || die
+ distutils-r1_src_prepare
+}
python_test() {
"${EPYTHON}" tests/test_pyperclip.py -vv ||