Add PyInstaller packaging for Windows and Linux
- label_app.spec: one-file build bundling fonts, emoji data, ttkbootstrap themes and (on Windows) fribidi.dll so Pillow can shape emoji sequences - build-windows.ps1 helper; assets/icon.ico app icon - Fonts resolved from assets/fonts first, then system dirs, so the app runs from a bundle or a checkout on any OS - Bump Pillow pin to 12.3
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
# PyInstaller spec for the Niimbot label designer.
|
||||
# Windows: pyinstaller label_app.spec -> dist/NiimbotLabel.exe
|
||||
# Linux: pyinstaller label_app.spec -> dist/NiimbotLabel
|
||||
# Build on the target OS; PyInstaller does not cross-compile.
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from PyInstaller.utils.hooks import collect_data_files
|
||||
|
||||
ROOT = Path(SPECPATH)
|
||||
|
||||
datas = [
|
||||
(str(ROOT / "assets" / "fonts"), "assets/fonts"),
|
||||
*collect_data_files("emoji_data_python"), # emoji.json
|
||||
*collect_data_files("ttkbootstrap"), # themes
|
||||
]
|
||||
|
||||
# Pillow's Windows wheel needs fribidi.dll for raqm text shaping (emoji sequences)
|
||||
binaries = []
|
||||
if sys.platform == "win32":
|
||||
binaries.append((str(ROOT / "assets" / "win" / "fribidi.dll"), "."))
|
||||
|
||||
a = Analysis(
|
||||
[str(ROOT / "label_app.py")],
|
||||
pathex=[str(ROOT)],
|
||||
datas=datas,
|
||||
binaries=binaries,
|
||||
hiddenimports=["serial.tools.list_ports", "PIL.ImageTk", "PIL._tkinter_finder"],
|
||||
excludes=["numpy", "matplotlib", "scipy", "pandas", "IPython"],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name="NiimbotLabel",
|
||||
icon=str(ROOT / "assets" / "icon.ico") if sys.platform == "win32" else None,
|
||||
console=False, # GUI app: no console window
|
||||
upx=False,
|
||||
strip=False,
|
||||
onefile=True,
|
||||
)
|
||||
Reference in New Issue
Block a user