summaryrefslogtreecommitdiff
path: root/qutebrowser/qt.py
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 15:51:24 +0100
commit41087d3adf42c48ef08f5851af43b26809753c4c (patch)
treeab1d34d518c588df971afd8792ae633869b7e30c /qutebrowser/qt.py
parent0e0369397c3bf23c7d8b753399fe6995fbac3ee6 (diff)
downloadqutebrowser-41087d3adf42c48ef08f5851af43b26809753c4c.tar.gz
qutebrowser-41087d3adf42c48ef08f5851af43b26809753c4c.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
Diffstat (limited to 'qutebrowser/qt.py')
-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]