From f2dbff92f49a39a214f89d6f5815b03f921e66a1 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sun, 2 Jul 2017 12:53:54 -0400 Subject: [PATCH] Check for PyQt.QtSql and sqlite in earlyinit. Show a graphical error box with install instructions if PyQt.QtSql is not found, rather than failing with CLI errors. Also show an error box if the sqlite driver is not available. --- qutebrowser/misc/earlyinit.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 9391288de..95f61708a 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -336,6 +336,13 @@ def check_libraries(backend): "http://pyyaml.org/download/pyyaml/ (py3.4) " "or Install via pip.", pip="PyYAML"), + 'PyQt5.QtSql': + _missing_str("PyQt5.QtSql", + windows="Use the installer by Riverbank computing " + "or the standalone qutebrowser exe. " + "http://www.riverbankcomputing.co.uk/" + "software/pyqt/download5", + pip="PyQt5"), } if backend == 'webengine': modules['PyQt5.QtWebEngineWidgets'] = _missing_str("QtWebEngine", @@ -393,6 +400,12 @@ def check_optimize_flag(): "unexpected behavior may occur.") +def check_sqlite(): + from PyQt5.QtSql import QSqlDatabase + if not QSqlDatabase.isDriverAvailable('SQLITE'): + _die('sqlite driver not available! Is sqlite installed?') + + def set_backend(backend): """Set the objects.backend global to the given backend (as string).""" from qutebrowser.misc import objects @@ -432,4 +445,5 @@ def earlyinit(args): check_libraries(backend) check_ssl_support(backend) check_optimize_flag() + check_sqlite() set_backend(backend)