summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-30 15:51:24 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-30 16:12:01 +0100
commit65c4ded183c1df2e76d04e4e0c44fad420ed3328 (patch)
tree7b120cce3ff007d493bb2dbae11d6fad37747d78
parentf123c1e8962c3a15431bbe58d85968433fbf55b6 (diff)
downloadqutebrowser-65c4ded183c1df2e76d04e4e0c44fad420ed3328.tar.gz
qutebrowser-65c4ded183c1df2e76d04e4e0c44fad420ed3328.zip
Re-add bare sip import
According to upstream, sip should be packaged as PyQt5.sip ever since PyQt 5.11: https://www.riverbankcomputing.com/static/Docs/PyQt5/incompatibilities.html#pyqt-v5-11 Since support for PyQt 5.11 was dropped for v2.0.0, importing from the old name was dropped in bff1b2a7d063f9093a50c8ed3ed94b777735e5d7 as well. However, some distributions (Ubuntu 20.04, most likely Debian, Guix, perhaps others?) package newer versions of PyQt5 while still using the old global "sip" package. Thus, this restores the (trivial) compatibility layer. Fixes #6082 (cherry picked from commit 41087d3adf42c48ef08f5851af43b26809753c4c)
-rw-r--r--qutebrowser/qt.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/qutebrowser/qt.py b/qutebrowser/qt.py
index 9f665be49..5e0f80538 100644
--- a/qutebrowser/qt.py
+++ b/qutebrowser/qt.py
@@ -20,4 +20,10 @@
"""Wrappers around Qt/PyQt code."""
# pylint: disable=unused-import
-from PyQt5 import sip
+
+# While upstream recommends using PyQt5.sip ever since PyQt5 5.11, some distributions
+# still package later versions of PyQt5 with a top-level "sip" rather than "PyQt5.sip".
+try:
+ from PyQt5 import sip
+except ImportError:
+ import sip # type: ignore[import, no-redef]