summaryrefslogtreecommitdiff
path: root/qutebrowser/config/qtargs.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-02-15 13:54:16 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-02-15 13:54:16 +0100
commit21089415434485b6cdb4949fef35fba8a3a9c48c (patch)
tree1dcfd440fbc865bab8db44f492d12d4957ac3dad /qutebrowser/config/qtargs.py
parent36b8d955b6ccabd7374f09339c6f157cb13f3958 (diff)
downloadqutebrowser-21089415434485b6cdb4949fef35fba8a3a9c48c.tar.gz
qutebrowser-21089415434485b6cdb4949fef35fba8a3a9c48c.zip
Avoid calling versions.webengine_versions() without QtWebEngine
Alternatively, it would have been possible to move the backend library checking from backendproblem.py to earlyinit.py entirely. However, this would lead to less user-friendly dialogs, as we can't e.g. offer a button to switch the backend setting. Fixes #6161
Diffstat (limited to 'qutebrowser/config/qtargs.py')
-rw-r--r--qutebrowser/config/qtargs.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py
index 7f971e2a0..66fa10339 100644
--- a/qutebrowser/config/qtargs.py
+++ b/qutebrowser/config/qtargs.py
@@ -58,6 +58,19 @@ def qt_args(namespace: argparse.Namespace) -> List[str]:
assert objects.backend == usertypes.Backend.QtWebKit, objects.backend
return argv
+ try:
+ from qutebrowser.browser.webengine import webenginesettings
+ except ImportError:
+ # This code runs before a QApplication is available, so before
+ # backendproblem.py is run to actually inform the user of the missing
+ # backend. Thus, we could end up in a situation where we're here, but
+ # QtWebEngine isn't actually available.
+ # We shouldn't call _qtwebengine_args() in this case as it relies on
+ # QtWebEngine actually being importable, e.g. in
+ # version.qtwebengine_versions().
+ log.init.debug("QtWebEngine requested, but unavailable...")
+ return argv
+
special_prefixes = (_ENABLE_FEATURES, _DISABLE_FEATURES, _BLINK_SETTINGS)
special_flags = [flag for flag in argv if flag.startswith(special_prefixes)]
argv = [flag for flag in argv if not flag.startswith(special_prefixes)]