Check libraries before Qt version

Importing qtutils for version_check needs pkg_resources, so we need to check
that's available earlier.

Also, import pkg_resources also shows warnings on older setuptools versions
because of invalid escapes, so we need to import it with warnings suppressed.
This commit is contained in:
Florian Bruhin 2017-09-18 13:32:21 +02:00
parent db807a1bbc
commit a17c4767d6
2 changed files with 2 additions and 12 deletions

View File

@ -349,9 +349,9 @@ def earlyinit(args):
# Now we can be sure QtCore is available, so we can print dialogs on # Now we can be sure QtCore is available, so we can print dialogs on
# errors, so people only using the GUI notice them as well. # errors, so people only using the GUI notice them as well.
backend = get_backend(args) backend = get_backend(args)
check_libraries(backend)
check_qt_version() check_qt_version()
remove_inputhook() remove_inputhook()
check_libraries(backend)
check_ssl_support(backend) check_ssl_support(backend)
check_optimize_flag() check_optimize_flag()
set_backend(backend) set_backend(backend)

View File

@ -31,6 +31,7 @@ import io
import operator import operator
import contextlib import contextlib
import pkg_resources
from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray, from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray,
QIODevice, QSaveFile, QT_VERSION_STR) QIODevice, QSaveFile, QT_VERSION_STR)
try: try:
@ -38,17 +39,6 @@ try:
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
qWebKitVersion = None qWebKitVersion = None
from qutebrowser.utils import log
with log.ignore_py_warnings(category=PendingDeprecationWarning, module='imp'):
with log.ignore_py_warnings(category=ImportWarning):
# This imports 'imp' and gives us a PendingDeprecationWarning on
# Debian Jessie.
#
# On Archlinux, we get ImportWarning from
# importlib/_bootstrap_external.py for modules with missing __init__.
import pkg_resources
MAXVALS = { MAXVALS = {
'int': 2 ** 31 - 1, 'int': 2 ** 31 - 1,