Improve earlyinit Qt/PyQt version messages

This commit is contained in:
Florian Bruhin 2017-02-21 19:15:22 +01:00
parent 9b07a9f77f
commit a179d6a738

View File

@ -262,17 +262,19 @@ def get_backend(args):
def check_qt_version(backend):
"""Check if the Qt version is recent enough."""
from PyQt5.QtCore import qVersion, PYQT_VERSION
from PyQt5.QtCore import qVersion, PYQT_VERSION, PYQT_VERSION_STR
from qutebrowser.utils import qtutils
if qtutils.version_check('5.2.0', operator.lt):
text = ("Fatal error: Qt and PyQt >= 5.2.0 are required, but {} is "
"installed.".format(qVersion()))
if (qtutils.version_check('5.2.0', operator.lt) or
PYQT_VERSION < 0x050200):
text = ("Fatal error: Qt and PyQt >= 5.2.0 are required, but Qt {} / "
"PyQt {} is installed.".format(qVersion(), PYQT_VERSION_STR))
_die(text)
elif (backend == 'webengine' and (
qtutils.version_check('5.7.0', operator.lt) or
PYQT_VERSION < 0x050701)):
text = ("Fatal error: Qt and PyQt >= 5.7.1 are required for "
"QtWebEngine support, but {} is installed.".format(qVersion()))
"QtWebEngine support, but Qt {} / PyQt {} is installed."
.format(qVersion(), PYQT_VERSION_STR))
_die(text)