Make sure pkg_resources is available.
This commit is contained in:
parent
903de515e7
commit
011bc75a79
@ -87,6 +87,7 @@ def main():
|
|||||||
log.init_log(args)
|
log.init_log(args)
|
||||||
earlyinit.fix_harfbuzz(args)
|
earlyinit.fix_harfbuzz(args)
|
||||||
earlyinit.check_pyqt_webkit()
|
earlyinit.check_pyqt_webkit()
|
||||||
|
earlyinit.check_pkg_resources()
|
||||||
# We do this import late as we need to fix harfbuzz first.
|
# We do this import late as we need to fix harfbuzz first.
|
||||||
from qutebrowser.app import Application
|
from qutebrowser.app import Application
|
||||||
app = Application(args)
|
app = Application(args)
|
||||||
|
@ -164,3 +164,36 @@ def check_pyqt_webkit():
|
|||||||
msgbox.exec_()
|
msgbox.exec_()
|
||||||
app.quit()
|
app.quit()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def check_pkg_resources():
|
||||||
|
"""Check if pkg_resources is installed."""
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||||
|
try:
|
||||||
|
import pkg_resources # pylint: disable=unused-variable
|
||||||
|
except ImportError:
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
msgbox = QMessageBox(QMessageBox.Critical, "qutebrowser: Fatal error!",
|
||||||
|
textwrap.dedent("""
|
||||||
|
Fatal error: pkg_resources is required to run qutebrowser but could
|
||||||
|
not be imported! Maybe it's not installed?
|
||||||
|
|
||||||
|
On Debian/Ubuntu:
|
||||||
|
apt-get install python3-pkg-resources
|
||||||
|
|
||||||
|
On Archlinux:
|
||||||
|
pacman -S python-setuptools
|
||||||
|
|
||||||
|
On Windows:
|
||||||
|
Run python -m ensurepip (python >= 3.4) or
|
||||||
|
scripts/ez_setup.py.
|
||||||
|
|
||||||
|
For other distributions:
|
||||||
|
Check your package manager for similiarly named packages.
|
||||||
|
""").strip())
|
||||||
|
if '--debug' in sys.argv:
|
||||||
|
print(file=sys.stderr)
|
||||||
|
traceback.print_exc()
|
||||||
|
msgbox.resize(msgbox.sizeHint())
|
||||||
|
msgbox.exec_()
|
||||||
|
app.quit()
|
||||||
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user