From d0461eece367d975d29a8da6c988db0dfb792c1d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 13 Apr 2017 15:48:46 +0200 Subject: [PATCH] Reorganize earlyinit checks We first do all checks we can without knowing the backend, before getting that. This is because we need to do some more stuff in get_backend now. --- qutebrowser/misc/earlyinit.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 1a0c361fc..c6a21a008 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -322,8 +322,7 @@ def check_libraries(backend): if backend == 'webengine': modules['PyQt5.QtWebEngineWidgets'] = _missing_str("QtWebEngine", webengine=True) - else: - assert backend == 'webkit' + elif backend == 'webkit': modules['PyQt5.QtWebKit'] = _missing_str("PyQt5.QtWebKit") modules['PyQt5.QtWebKitWidgets'] = _missing_str( "PyQt5.QtWebKitWidgets") @@ -407,10 +406,15 @@ def earlyinit(args): fix_harfbuzz(args) # 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. - backend = get_backend(args) - check_qt_version(backend) + # + # First do some early version checks, without knowing the backend. + check_qt_version(None) remove_inputhook() - check_libraries(backend) + check_libraries(None) check_ssl_support() check_optimize_flag() + # Now find out the backend to use, and do the rest of the checks + backend = get_backend(args) + check_qt_version(backend) + check_libraries(backend) set_backend(backend)