summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2023-11-05 17:16:34 +1300
committertoofar <toofar@spalge.com>2023-11-05 17:49:13 +1300
commita7f154662e05085a492a7c95948e91289f4d22ef (patch)
treeeb3212a541907589ab137893aeb9908ef7c189a7
parentf26a477d7cb61404f5c426fee346d2dffc5c7d45 (diff)
downloadqutebrowser-a7f154662e05085a492a7c95948e91289f4d22ef.tar.gz
qutebrowser-a7f154662e05085a492a7c95948e91289f4d22ef.zip
Fix resource pak file location on mac.
On CI I'm seeing: No such file or directory: '/Users/runner/work/qutebrowser/qutebrowser/.tox/py39-pyqt515/lib/python3.9/site-packages/PyQt5/Qt5/resources' Downloading the PyQt6_WebEngine_Qt6 wheel for mac from PyPI I can see the pak file is at: ./PyQt6/Qt6/lib/QtWebEngineCore.framework/Resources/qtwebengine_resources.pak And on a qutebrowser install made by pyinstaller it is at (symlinks in curly braces): /Applications/qutebrowser.app/Contents/{Resources,Frameworks}/PyQt6/Qt6/lib/QtWebEngineCore.framework/{Resources,Versions/A/Resources}/qtwebengine_resources.pak And the Qt data path for reference is: /Applications/qutebrowser.app/Contents/Frameworks/PyQt6/Qt6 So it looks like essentially we need to add a "lib/QtWebEngineCore.framework" in there and capitalise "Resources". A bit annoying to have the special case and hardocde paths like this. But it should be pretty stable? I had a look at importlib_resources to try to see if it could fine this stuff for us but I don't think it can. I've checked with the pyinstaller windows builds and with the windows wheel from PyPI and neither seem to need any special handling.
-rw-r--r--qutebrowser/misc/pakjoy.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/qutebrowser/misc/pakjoy.py b/qutebrowser/misc/pakjoy.py
index 84ab5218b..52e50e0f8 100644
--- a/qutebrowser/misc/pakjoy.py
+++ b/qutebrowser/misc/pakjoy.py
@@ -146,7 +146,15 @@ class PakParser:
def copy_webengine_resources():
"""Copy qtwebengine resources to local dir for patching."""
- resources_dir = qtutils.library_path(qtutils.LibraryPath.data) / "resources"
+ resources_dir = qtutils.library_path(qtutils.LibraryPath.data)
+ if utils.is_mac:
+ # I'm not sure how to arrive at this path without hardcoding it
+ # ourselves. importlib_resources("PyQt6.Qt6") can serve as a
+ # replacement for the qtutils bit but it doesn't seem to help find the
+ # actually Resources folder.
+ resources_dir /= "lib" / "QtWebEngineCore.framework" / "Resources"
+ else:
+ resources_dir /= "resources"
work_dir = pathlib.Path(standarddir.cache()) / "webengine_resources_pak_quirk"
log.misc.debug(