Cotton code
18 lines · 945 B · ShellRaw
#!/usr/bin/env bash# The Python the voice tools run on: $VOICE_PYTHON, else a venv under# ${VOICE_HOME:-~/.cache/cotton-voice}/venv made on first use from# requirements.txt (the one step that reaches the network; measuring never does).set -euo pipefailHERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"if [ -n "${VOICE_PYTHON:-}" ]; then echo "$VOICE_PYTHON"; exit 0; fiVENV="${VOICE_HOME:-$HOME/.cache/cotton-voice}/venv"if [ ! -x "$VENV/bin/python" ] || ! cmp -s "$HERE/requirements.txt" "$VENV/.requirements.txt"; then  echo "[voice] making $VENV from scripts/voice/requirements.txt" >&2  if command -v uv >/dev/null; then    uv venv -q -p 3.12 "$VENV" >&2 && VIRTUAL_ENV="$VENV" uv pip install -q -r "$HERE/requirements.txt" >&2  else    python3 -m venv "$VENV" >&2 && "$VENV/bin/python" -m pip install -q -r "$HERE/requirements.txt" >&2  fi  cp "$HERE/requirements.txt" "$VENV/.requirements.txt"fiecho "$VENV/bin/python"