build_release: Patch macOS app to save some space
This commit is contained in:
parent
b63af145d9
commit
737db48c14
@ -101,8 +101,9 @@ def smoke_test(executable):
|
||||
|
||||
|
||||
def patch_mac_app():
|
||||
"""Patch .app to use our Info.plist."""
|
||||
"""Patch .app to use our Info.plist and 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:
|
||||
@ -111,6 +112,24 @@ def patch_mac_app():
|
||||
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', 'Resources', 'PyQt5', 'Qt', 'lib', 'QtWebEngineCore.framework')
|
||||
|
||||
core_lib = os.path.join(framework_path, 'Versions', '5', 'QtWebEngineCore')
|
||||
os.remove(core_lib)
|
||||
core_target = os.path.join(*[os.pardir] * 7, 'MacOS', 'QtWebEngineCore')
|
||||
os.symlink(core_target, core_lib)
|
||||
|
||||
framework_resource_path = os.path.join(framework_path, 'Resources')
|
||||
for name in os.listdir(framework_resource_path):
|
||||
file_path = os.path.join(framework_resource_path, name)
|
||||
target = os.path.join(*[os.pardir] * 5, name)
|
||||
if os.path.isdir(file_path):
|
||||
shutil.rmtree(file_path)
|
||||
else:
|
||||
os.remove(file_path)
|
||||
os.symlink(target, file_path)
|
||||
|
||||
|
||||
INFO_PLIST_UPDATES = {
|
||||
'CFBundleVersion': qutebrowser.__version__,
|
||||
|
Loading…
Reference in New Issue
Block a user