#!/bin/sh
# Runs Python with numpy (what the motion-studio audio scripts need). setup.sh decides which interpreter.
D="$(cd "$(dirname "$0")/.." && pwd)"
if [ -x "$D/.venv/bin/python" ]; then exec "$D/.venv/bin/python" "$@"; fi
if [ -x "$D/.venv/Scripts/python.exe" ]; then exec "$D/.venv/Scripts/python.exe" "$@"; fi
if [ -f "$D/.python" ]; then exec "$(cat "$D/.python")" "$@"; fi
if ! python3 -c "import numpy" >/dev/null 2>&1; then
  echo "scripts/py: python3 has no numpy. Run: bash \"$D/scripts/setup.sh\" (it makes $D/.venv), or: python3 -m venv \"$D/.venv\" && \"$D/.venv/bin/pip\" install numpy pillow" >&2
fi
exec python3 "$@"
