From d37f5b7be0d8ece8d29e020b22b3eec12b2150fa Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 26 Mar 2024 13:57:07 +0100 Subject: Ignore already imported Qt module with PyInstaller Starting with PyInstaller 6.5.0, it imports Qt bindings early, due to this change: https://github.com/pyinstaller/pyinstaller/pull/8315 We warn about this in order to avoid unintentional early Qt imports in qutebrowser. However, in the case of using PyInstaller, we just suppress the warning now, as it's not us to blame. See https://github.com/qutebrowser/qutebrowser/pull/8123 --- qutebrowser/qt/machinery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/qt/machinery.py b/qutebrowser/qt/machinery.py index f9e3721f8..9f45dd6ce 100644 --- a/qutebrowser/qt/machinery.py +++ b/qutebrowser/qt/machinery.py @@ -168,9 +168,9 @@ def _select_wrapper(args: Optional[argparse.Namespace]) -> SelectionInfo: - Otherwise, try the wrappers in WRAPPER in order (PyQt6 -> PyQt5) """ # If any Qt wrapper has been imported before this, something strange might - # be happening. + # be happening. With PyInstaller, it imports the Qt bindings early. for name in WRAPPERS: - if name in sys.modules: + if name in sys.modules and not hasattr(sys, "frozen"): warnings.warn(f"{name} already imported", stacklevel=1) if args is not None and args.qt_wrapper is not None: -- cgit v1.2.3-54-g00ecf