Files
rectify/rectify.spec

112 lines
3.3 KiB
RPMSpec
Raw Permalink Normal View History

2026-08-04 18:31:51 +02:00
# -*- mode: python ; coding: utf-8 -*-
"""PyInstaller spec file for Rectify.
Build with:
pyinstaller rectify.spec
Produces:
dist/rectify/ (onedir bundle: launcher + all libs as real files)
dist/rectify.exe (Windows single-file executable)
dist/Rectify.app (macOS .app bundle, macOS only)
macOS uses a ONEDIR build (not onefile) on purpose: notarization requires
every nested .dylib/.so to be individually code-signed, which is only
possible when they sit on disk as real files rather than packed inside a
single executable. UPX is disabled for the same reason it rewrites
Mach-O headers and invalidates signatures.
Signing and notarization are handled end-to-end by build_dmg.sh:
./build_dmg.sh --sign "Developer ID Application: Andrew Kopra (KF3QXUS8G6)" \
--notarize andykopra-notary
"""
import sys
from PyInstaller.utils.hooks import collect_all
VERSION = '0.2.0'
# pillow-heif ships a native libheif and has no bundled PyInstaller hook,
# so collect its binaries/data/submodules explicitly. (Verify on a real
# build per platform — native HEIF libs are the fragile part of bundling.)
_heif_datas, _heif_binaries, _heif_hidden = collect_all('pillow_heif')
a = Analysis(
['rectify/__main__.py'],
pathex=[],
binaries=_heif_binaries,
datas=_heif_datas,
hiddenimports=[
'PySide6.QtWidgets',
'PySide6.QtGui',
'PySide6.QtCore',
'pillow_heif',
'PIL.Image',
'PIL.ImageCms',
*_heif_hidden,
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True, # onedir: keep libraries OUT of the executable so each
# nested dylib/.so is a real, individually signable file
name='rectify',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False, # UPX rewrites Mach-O headers and breaks code signing
console=False, # GUI application — no console window
icon=None, # TODO: add application icon (.ico for Windows, .icns for macOS)
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name='rectify',
)
# macOS .app bundle (only used when building on macOS)
if sys.platform == 'darwin':
app = BUNDLE(
coll,
name='Rectify.app',
icon='resources/Rectify.icns',
bundle_identifier='com.andykopra.rectify',
info_plist={
'CFBundleName': 'Rectify',
'CFBundleDisplayName': 'Rectify',
'CFBundleShortVersionString': VERSION,
'CFBundleVersion': VERSION,
'NSHighResolutionCapable': True,
# File type associations — allows "Open with" and drag-to-icon
'CFBundleDocumentTypes': [
{
'CFBundleTypeName': 'Image',
'CFBundleTypeRole': 'Editor',
'LSHandlerRank': 'Alternate',
'LSItemContentTypes': [
'public.jpeg',
'public.png',
'public.tiff',
'com.microsoft.bmp',
'org.webmproject.webp',
],
},
],
},
)