From 9a638b2dba1db56cc152280fa6be0f972aeaf261 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 19 Feb 2017 15:41:20 +0100 Subject: [PATCH] Patch OS X .app to work with QtWebEngine --- scripts/dev/build_release.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 95241e5ac..f1fc7e11f 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -23,6 +23,7 @@ import os import sys +import glob import os.path import shutil import subprocess @@ -90,12 +91,40 @@ def smoke_test(executable): '--temp-basedir', 'about:blank', ':later 500 quit']) +def patch_osx_app(): + """Patch .app for https://github.com/pyinstaller/pyinstaller/issues/2276""" + app_path = os.path.join('dist', 'qutebrowser.app') + qtwe_core_dir = os.path.join('.tox', 'pyinstaller', 'lib', 'python3.6', + 'site-packages', 'PyQt5', 'Qt', 'lib', + 'QtWebengineCore.framework') + # Copy QtWebEngineProcess.app + proc_app = 'QtWebEngineProcess.app' + shutil.copytree(os.path.join(qtwe_core_dir, 'Helpers', proc_app), + os.path.join(app_path, 'Contents', 'MacOS', proc_app)) + # Copy resources + for f in glob.glob(os.path.join(qtwe_core_dir, 'Resources', '*')): + dest = os.path.join(app_path, 'Contents', 'Resources') + if os.path.isdir(f): + shutil.copytree(f, os.path.join(dest, f)) + else: + shutil.copy(f, dest) + # Link dependencies + for lib in ['QtCore', 'QtWebEngineCore', 'QtQuick', 'QtQml', 'QtNetwork', + 'QtGui', 'QtWebChannel', 'QtPositioning']: + dest = os.path.join(app_path, lib + '.framework', 'Versions', '5') + os.makedirs(dest) + os.symlink(os.path.join(os.pardir, os.pardir, os.pardir, 'Contents', 'MacOS', lib), + os.path.join(dest, lib)) + + def build_osx(): """Build OS X .dmg/.app.""" utils.print_title("Updating 3rdparty content") update_3rdparty.update_pdfjs() utils.print_title("Building .app via pyinstaller") call_tox('pyinstaller', '-r') + utils.print_title("Patching .app") + patch_osx_app() utils.print_title("Building .dmg") subprocess.check_call(['make', '-f', 'scripts/dev/Makefile-dmg']) utils.print_title("Cleaning up...")