Repository navigation
Expand file tree
/
Copy pathopenflow.spec
More file actions
113 lines (106 loc) · 3.98 KB
/
Copy pathopenflow.spec
File metadata and controls
113 lines (106 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# PyInstaller spec for OpenFlow.
# Produces dist/OpenFlow.app (macOS bundle) and dist/openflow (Linux/Windows).
#
# Build:
# source .venv/bin/activate
# pyinstaller openflow.spec
#
# Run the resulting bundle:
# open dist/OpenFlow.app # macOS
# ./dist/openflow/openflow # Linux
# -- Imports --------------------------------------------------------------
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
import sys
block_cipher = None
is_macos = sys.platform == "darwin"
# httpx is used for Sarvam STT + chat (WAV payloads: wavio.py, stdlib)
hidden = []
hidden += collect_submodules("httpx")
# websockets: Sarvam realtime (streaming) STT, imported lazily by stream_stt
hidden += collect_submodules("websockets")
hidden += collect_submodules("pynput")
hidden += collect_submodules("rumps")
hidden += collect_submodules("darkdetect")
hidden += collect_submodules("PIL")
hidden += collect_submodules("rapidfuzz")
hidden += collect_submodules("AppKit")
hidden += collect_submodules("ui")
hidden += ["sarvam", "transcribe", "stream_stt", "ai", "llm", "permissions", "httpcore", "h11", "anyio", "certifi"]
# The hub imports its pages lazily (importlib), which PyInstaller's import
# scan can't follow, so list them (and the Qt modules it needs) explicitly.
hidden += ["ui.hub", "ui.hub.app", "ui.hub.page", "ui.hub.style", "ui.hub.context",
"ui.hub.pages",
*(f"ui.hub.pages.{p}" for p in
("home", "insights", "history", "dictionary", "tones", "settings", "help")),
"ui.first_run", "PyQt6.QtSvg", "PyQt6.QtNetwork"]
datas = []
datas += collect_data_files("certifi")
# Ship our own assets (fonts incl. JetBrains Mono, logo incl. the hub's Dock
# icon assets/logo/icon.png, tray, sounds). Empty subdirs are bundled so
# runtime loaders find the expected layout even before designed assets land.
datas += [("assets", "assets")]
# -- Analysis -------------------------------------------------------------
a = Analysis(
["launcher.py"],
pathex=["."],
binaries=[],
datas=datas,
hiddenimports=hidden,
hookspath=[],
runtime_hooks=[],
# scipy: no longer used (wavio.py). rich / click / pygments: httpx's
# optional CLI, which it imports at start-up whenever they are present
# (~7 MB in every process that uses httpx); the app never calls it.
excludes=["tkinter", "matplotlib", "pandas", "IPython",
"scipy", "rich", "click", "pygments"],
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
# -- Single-folder build (works everywhere) --------------------------------
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name="openflow",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=not is_macos, # macOS: windowed (no terminal); other: console
disable_windowed_traceback=False,
target_arch=None,
codesign_identity="OpenFlow Local Dev",
entitlements_file="entitlements.plist",
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name="openflow",
)
# -- macOS .app bundle ----------------------------------------------------
if is_macos:
app = BUNDLE(
coll,
name="OpenFlow.app",
icon="assets/logo/icon.icns",
bundle_identifier="com.openflow.dictation",
info_plist={
"LSUIElement": True, # tray-only, no Dock icon
# Background tray app: App Nap throttles the widget-pump loop
# (mic level, Undo/Retry timers, widget watchdog).
"NSAppSleepDisabled": True,
"CFBundleShortVersionString": "0.1.0",
"NSMicrophoneUsageDescription":
"OpenFlow needs the microphone to capture your dictation.",
"NSAppleEventsUsageDescription":
"OpenFlow uses System Events to paste text into the focused app.",
"NSHighResolutionCapable": True,
},
)