From 636db82c0668b52cf1ecf385a966df5b1b00ca2a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 18 Jul 2019 14:36:39 +0200 Subject: 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) --- qutebrowser/misc/earlyinit.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) -- cgit v1.2.3-54-g00ecf