diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-07-18 14:36:39 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-07-18 15:41:54 +0200 |
commit | 636db82c0668b52cf1ecf385a966df5b1b00ca2a (patch) | |
tree | 5bcfc13ed4c040de7270c411c8903c840d44bbe1 | |
parent | 80f7dd7236285ba75f91380ffdb6f39c4cf54f39 (diff) | |
download | qutebrowser-636db82c0668b52cf1ecf385a966df5b1b00ca2a.tar.gz qutebrowser-636db82c0668b52cf1ecf385a966df5b1b00ca2a.zip |
Add workaround for missing QtCore with PyInstaller
See https://github.com/pyinstaller/pyinstaller/issues/4293
and https://github.com/gridsync/gridsync/pull/236/commits/0abf8e7363cc8c2a10a0263e6dcceb3be1c07022
(cherry picked from commit e58aa9c8ae37398dd09b0bf83dc4df90b10827b5)
-rw-r--r-- | qutebrowser/misc/earlyinit.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index e8040c670..36d61e53d 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -29,6 +29,7 @@ try: except ImportError: hunter = None +import os import sys import faulthandler import traceback @@ -130,6 +131,18 @@ def init_faulthandler(fileobj=sys.__stderr__): # pylint: enable=no-member,useless-suppression +def pyinstaller_qt_workaround(): + """Work around PATH issues with PyInstaller. + + See https://github.com/pyinstaller/pyinstaller/issues/4293 + and https://github.com/gridsync/gridsync/pull/236/commits/0abf8e7363cc8c2a10a0263e6dcceb3be1c07022 + """ + if (hasattr(sys, 'frozen') and + hasattr(sys, '_MEIPASS') and + sys.platform == 'win32'): + os.environ['PATH'] += os.pathsep + sys._MEIPASS + + def check_pyqt_core(): """Check if PyQt core is installed.""" try: @@ -288,6 +301,7 @@ def early_init(args): init_faulthandler() # Here we check if QtCore is available, and if not, print a message to the # console or via Tk. + pyinstaller_qt_workaround() check_pyqt_core() # Init logging as early as possible init_log(args) |