#!/bin/sh
# Runs the browse-ext tool with the SDK in this repository. Needs Python 3.11 or later.
HERE="$(cd "$(dirname "$0")/.." && pwd)"
for candidate in "$BROWSE_PYTHON" python3.14 python3.13 python3.12 python3.11 python3; do
  [ -n "$candidate" ] || continue
  if command -v "$candidate" >/dev/null 2>&1 && "$candidate" -c 'import sys; sys.exit(sys.version_info < (3, 11))' 2>/dev/null; then
    PYTHONPATH="$HERE/python${PYTHONPATH:+:$PYTHONPATH}" exec "$candidate" -B -m browse.devtools "$@"
  fi
done
echo "browse-ext needs Python 3.11 or later (set BROWSE_PYTHON to choose one)" >&2
exit 1
