Files
audio-scribe/scripts/build-binary.sh
T
JMR-devandClaude Opus 5 e459606e89 feat(packaging): ship as a tool install or a self-contained directory
Two ways to get `ccn-transcribe` on PATH. `uv tool install .` is the light one.
scripts/build-binary.sh produces a ~450 MB directory that needs neither Python
nor uv, which turned out to work despite OpenVINO resolving 47 plugins by
dlopen at runtime -- the frozen build reports CPU, GPU and transcribes on the
GPU to a byte-identical transcript.

Two things that build needs. PyInstaller points sys.prefix at the bundle, so
deno goes in bin/ and the runtime lookup finds it with no frozen-app special
case in the package. And a frozen executable is re-invoked to start a
multiprocessing child, which parsed the interpreter's own -B flag as a CLI
option and printed "No such option '-B'" twice per run before dying;
freeze_support() in the entry point makes that child do its job and exit.

onedir, not onefile: onefile would extract 450 MB to /tmp on every launch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 19:10:51 -05:00

26 lines
938 B
Bash
Executable File

#!/usr/bin/env bash
# Build a self-contained ccn-transcribe directory that runs without Python or uv.
#
# onedir, never onefile: onefile extracts ~450 MB to /tmp on every launch.
# deno lands in bin/ because PyInstaller points sys.prefix at the bundle, which
# is where the package already looks for the JS runtime it ships with.
set -euo pipefail
cd "$(dirname "$0")/.."
DIST=${1:-dist}
uv run --locked --with pyinstaller pyinstaller \
--noconfirm --onedir --name ccn-transcribe \
--distpath "$DIST" --workpath "build/pyinstaller" --specpath "build" \
--collect-all openvino \
--collect-all openvino_genai \
--collect-all openvino_tokenizers \
--collect-all yt_dlp \
--collect-all yt_dlp_ejs \
--add-binary "$PWD/.venv/bin/deno:bin" \
src/ccn_transcribe/__main__.py
echo
echo "built $DIST/ccn-transcribe ($(du -sh "$DIST/ccn-transcribe" | cut -f1))"
echo "verify it with: $DIST/ccn-transcribe/ccn-transcribe doctor"