-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptSurgeon-mac.spec
More file actions
161 lines (148 loc) · 4.23 KB
/
Copy pathScriptSurgeon-mac.spec
File metadata and controls
161 lines (148 loc) · 4.23 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# -*- mode: python ; coding: utf-8 -*-
"""PyInstaller macOS application bundle for ScriptSurgeon.
Run this spec only on a native macOS runner. The build script stages a
same-architecture FFmpeg binary, a verified Whisper model snapshot, and a
generated ICNS icon before invoking PyInstaller.
"""
import os
from pathlib import Path
from PyInstaller.utils.hooks import collect_all
ROOT = Path(SPECPATH).resolve()
FRONTEND_DIST = ROOT / "frontend" / "dist"
MODEL_DIR = ROOT / "vendor" / "models" / "faster-whisper-base"
FFMPEG_BINARY = ROOT / "vendor" / "ffmpeg" / "ffmpeg"
ICON_FILE = Path(
os.environ.get("SCRIPTSURGEON_MAC_ICON_PATH", ROOT / "build" / "macos-assets" / "scriptcut.icns")
).resolve()
BUILD_INFO = Path(os.environ.get("SCRIPTCUT_BUILD_INFO_PATH", ROOT / "build" / "build-info.json"))
LICENSE_FILE = ROOT / "LICENSE"
THIRD_PARTY_NOTICES = ROOT / "THIRD_PARTY_NOTICES.md"
BUILD_VERSION = os.environ.get("SCRIPTCUT_BUILD_VERSION", "0.0.0")
TARGET_ARCH = os.environ.get("SCRIPTSURGEON_MAC_TARGET_ARCH") or None
CODE_SIGN_IDENTITY = os.environ.get("SCRIPTSURGEON_CODESIGN_IDENTITY") or None
ENTITLEMENTS_FILE = os.environ.get("SCRIPTSURGEON_MAC_ENTITLEMENTS") or None
required = [
FRONTEND_DIST,
MODEL_DIR / "model.bin",
FFMPEG_BINARY,
ICON_FILE,
BUILD_INFO,
LICENSE_FILE,
THIRD_PARTY_NOTICES,
]
missing = [str(path) for path in required if not path.exists()]
if missing:
raise SystemExit(
"ScriptSurgeon macOS packaging inputs are missing. Run scripts/build-macos.sh first:\n "
+ "\n ".join(missing)
)
datas = [
(str(FRONTEND_DIST), "frontend/dist"),
(str(MODEL_DIR), "models/faster-whisper-base"),
(str(ICON_FILE), "assets"),
(str(BUILD_INFO), "."),
(str(LICENSE_FILE), "."),
(str(THIRD_PARTY_NOTICES), "."),
]
binaries = [(str(FFMPEG_BINARY), "bin")]
hiddenimports = [
"backend.main",
"backend.render",
"backend.transcribe",
"uvicorn.logging",
"uvicorn.lifespan.on",
"uvicorn.loops.asyncio",
"uvicorn.protocols.http.h11_impl",
# pywebview picks its backend dynamically. Make Cocoa/WebKit explicit so
# PyInstaller does not discard it as an unobserved runtime import.
"webview.platforms.cocoa",
"objc",
"Foundation",
"AppKit",
"WebKit",
"Quartz",
"Security",
"UniformTypeIdentifiers",
]
for package in (
"faster_whisper",
"ctranslate2",
"av",
"onnxruntime",
"tokenizers",
"webview",
):
package_datas, package_binaries, package_hiddenimports = collect_all(package)
datas += package_datas
binaries += package_binaries
hiddenimports += package_hiddenimports
a = Analysis(
[str(ROOT / "desktop.py")],
pathex=[str(ROOT)],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[
"torch",
"PyQt5",
"PyQt6",
"PySide2",
"PySide6",
"cefpython3",
# Windows-only pywebview dependencies must never be selected by a
# macOS release build.
"pythonnet",
"clr_loader",
],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name="ScriptSurgeon",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=TARGET_ARCH,
codesign_identity=CODE_SIGN_IDENTITY,
entitlements_file=ENTITLEMENTS_FILE,
icon=str(ICON_FILE),
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name="ScriptSurgeon",
)
app = BUNDLE(
coll,
name="ScriptSurgeon.app",
version=BUILD_VERSION,
icon=str(ICON_FILE),
bundle_identifier="com.artmoreno.scriptsurgeon",
info_plist={
"CFBundleDisplayName": "ScriptSurgeon",
"CFBundleName": "ScriptSurgeon",
"CFBundleShortVersionString": BUILD_VERSION,
"CFBundleVersion": BUILD_VERSION,
"NSHighResolutionCapable": True,
"NSMicrophoneUsageDescription": (
"ScriptSurgeon uses the microphone only when you choose to record "
"a new project or an insert."
),
},
)