metube/build-ytdlp.sh

32 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build the private yt-dlp wheel (locally-patched build) and stage it for the
# Docker image.
#
# MeTube pins the official yt-dlp release via uv.lock. Until the upstream fix
# lands, a wheel built from a local yt-dlp checkout is baked into the image
# instead (see the Dockerfile). This script produces vendor/yt_dlp.whl.
#
# Usage:
# ./build-ytdlp.sh # uses ~/Dev/github/yt-dlp
# YTDLP_REPO=/path/to/yt-dlp ./build-ytdlp.sh
set -euo pipefail
cd "$(dirname "$0")"
YTDLP_REPO="${YTDLP_REPO:-$HOME/Dev/github/yt-dlp}"
OUT_DIR="$(pwd)/vendor"
mkdir -p "$OUT_DIR"
if [[ ! -d "$YTDLP_REPO" ]]; then
echo "Error: local yt-dlp checkout not found at $YTDLP_REPO" >&2
echo "Set YTDLP_REPO to your patched checkout, or drop the override (see DEPLOY.md)." >&2
exit 1
fi
echo "Building yt-dlp wheel from $YTDLP_REPO ..."
(cd "$YTDLP_REPO" && uv build --wheel -o "$OUT_DIR")
# Keep the original wheel filename (uv requires it to encode the version).
echo "Wheel ready:"
ls -1 "$OUT_DIR"/yt_dlp-*.whl