summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-06-16 17:49:50 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-06-16 17:52:35 +0200
commit46de10722cd486190bda052510806de2c8fffda2 (patch)
tree2e1861ac8d088d6b5a4dbe4030f7eebaa25f5bc2
parent9e2c5d493b13476fca228bb67e2d0adc08d7ccd9 (diff)
downloadqutebrowser-46de10722cd486190bda052510806de2c8fffda2.tar.gz
qutebrowser-46de10722cd486190bda052510806de2c8fffda2.zip
build-release: Move macOS Info.plist back to PyInstaller .spec
The patching was originally introduced back in 2017 in #3055, when PyInstaller only supported very basic Info.plist operations. This changed in 2018 (!) however, with PyInstaller 3.4: https://pyinstaller.org/en/stable/CHANGES-3.html#id8 https://github.com/pyinstaller/pyinstaller/pull/3532 Thus, let's move this back to PyInstaller. This produces exactly the same Info.plist as before. Fixes #7251
-rw-r--r--misc/qutebrowser.spec47
-rwxr-xr-xscripts/dev/build_release.py56
2 files changed, 48 insertions, 55 deletions
diff --git a/misc/qutebrowser.spec b/misc/qutebrowser.spec
index 60729266e..f7ce81226 100644
--- a/misc/qutebrowser.spec
+++ b/misc/qutebrowser.spec
@@ -6,11 +6,57 @@ import os
sys.path.insert(0, os.getcwd())
from scripts import setupcommon
+import qutebrowser
from qutebrowser.extensions import loader
block_cipher = None
+INFO_PLIST_UPDATES = {
+ 'CFBundleVersion': qutebrowser.__version__,
+ 'CFBundleShortVersionString': qutebrowser.__version__,
+ 'NSSupportsAutomaticGraphicsSwitching': True,
+ 'NSHighResolutionCapable': True,
+ 'NSRequiresAquaSystemAppearance': False,
+ 'CFBundleURLTypes': [{
+ "CFBundleURLName": "http(s) URL",
+ "CFBundleURLSchemes": ["http", "https"]
+ }, {
+ "CFBundleURLName": "local file URL",
+ "CFBundleURLSchemes": ["file"]
+ }],
+ 'CFBundleDocumentTypes': [{
+ "CFBundleTypeExtensions": ["html", "htm"],
+ "CFBundleTypeMIMETypes": ["text/html"],
+ "CFBundleTypeName": "HTML document",
+ "CFBundleTypeOSTypes": ["HTML"],
+ "CFBundleTypeRole": "Viewer",
+ }, {
+ "CFBundleTypeExtensions": ["xhtml"],
+ "CFBundleTypeMIMETypes": ["text/xhtml"],
+ "CFBundleTypeName": "XHTML document",
+ "CFBundleTypeRole": "Viewer",
+ }],
+
+ # https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos
+ #
+ # Keys based on Google Chrome's .app, except Bluetooth keys which seem to
+ # be iOS-only.
+ #
+ # If we don't do this, we get a SIGABRT from macOS when those permissions
+ # are used, and even in some other situations (like logging into Google
+ # accounts)...
+ 'NSCameraUsageDescription':
+ 'A website in qutebrowser wants to use the camera.',
+ 'NSLocationUsageDescription':
+ 'A website in qutebrowser wants to use your location information.',
+ 'NSMicrophoneUsageDescription':
+ 'A website in qutebrowser wants to use your microphone.',
+ 'NSBluetoothAlwaysUsageDescription':
+ 'A website in qutebrowser wants to access Bluetooth.',
+}
+
+
def get_data_files():
data_files = [
('../qutebrowser/html', 'html'),
@@ -85,5 +131,6 @@ coll = COLLECT(exe,
app = BUNDLE(coll,
name='qutebrowser.app',
icon=icon,
+ info_plist=INFO_PLIST_UPDATES,
# https://github.com/pyinstaller/pyinstaller/blob/b78bfe530cdc2904f65ce098bdf2de08c9037abb/PyInstaller/hooks/hook-PyQt5.QtWebEngineWidgets.py#L24
bundle_identifier='org.qt-project.Qt.QtWebEngineCore')
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py
index f57fa4772..b078c66a2 100755
--- a/scripts/dev/build_release.py
+++ b/scripts/dev/build_release.py
@@ -27,7 +27,6 @@ import sys
import time
import shutil
import pathlib
-import plistlib
import subprocess
import argparse
import tarfile
@@ -215,17 +214,9 @@ def verify_windows_exe(exe_path):
def patch_mac_app():
- """Patch .app to use our Info.plist and save some space."""
+ """Patch .app to save some space."""
app_path = os.path.join('dist', 'qutebrowser.app')
- # Patch Info.plist - pyinstaller's options are too limiting
- plist_path = os.path.join(app_path, 'Contents', 'Info.plist')
- with open(plist_path, "rb") as f:
- plist_data = plistlib.load(f)
- plist_data.update(INFO_PLIST_UPDATES)
- with open(plist_path, "wb") as f:
- plistlib.dump(plist_data, f)
-
# Replace some duplicate files by symlinks
framework_path = os.path.join(app_path, 'Contents', 'MacOS', 'PyQt5',
'Qt5', 'lib', 'QtWebEngineCore.framework')
@@ -246,51 +237,6 @@ def patch_mac_app():
os.symlink(target, file_path)
-INFO_PLIST_UPDATES = {
- 'CFBundleVersion': qutebrowser.__version__,
- 'CFBundleShortVersionString': qutebrowser.__version__,
- 'NSSupportsAutomaticGraphicsSwitching': True,
- 'NSHighResolutionCapable': True,
- 'NSRequiresAquaSystemAppearance': False,
- 'CFBundleURLTypes': [{
- "CFBundleURLName": "http(s) URL",
- "CFBundleURLSchemes": ["http", "https"]
- }, {
- "CFBundleURLName": "local file URL",
- "CFBundleURLSchemes": ["file"]
- }],
- 'CFBundleDocumentTypes': [{
- "CFBundleTypeExtensions": ["html", "htm"],
- "CFBundleTypeMIMETypes": ["text/html"],
- "CFBundleTypeName": "HTML document",
- "CFBundleTypeOSTypes": ["HTML"],
- "CFBundleTypeRole": "Viewer",
- }, {
- "CFBundleTypeExtensions": ["xhtml"],
- "CFBundleTypeMIMETypes": ["text/xhtml"],
- "CFBundleTypeName": "XHTML document",
- "CFBundleTypeRole": "Viewer",
- }],
-
- # https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos
- #
- # Keys based on Google Chrome's .app, except Bluetooth keys which seem to
- # be iOS-only.
- #
- # If we don't do this, we get a SIGABRT from macOS when those permissions
- # are used, and even in some other situations (like logging into Google
- # accounts)...
- 'NSCameraUsageDescription':
- 'A website in qutebrowser wants to use the camera.',
- 'NSLocationUsageDescription':
- 'A website in qutebrowser wants to use your location information.',
- 'NSMicrophoneUsageDescription':
- 'A website in qutebrowser wants to use your microphone.',
- 'NSBluetoothAlwaysUsageDescription':
- 'A website in qutebrowser wants to access Bluetooth.',
-}
-
-
def _mac_bin_path(base):
"""Get the macOS qutebrowser binary path."""
return os.path.join(base, 'qutebrowser.app', 'Contents', 'MacOS', 'qutebrowser')