#!/bin/sh # Install the host Python dependencies needed by flash-edl.py into a # repository-local directory, so a clean clone can flash autonomously. set -eu BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)" PYTHON_BIN="${PYTHON_BIN:-python3}" TARGET="$BASE_DIR/.flash-deps" if "$PYTHON_BIN" -c 'import usb.core, serial' >/dev/null 2>&1; then echo "[flash-deps] pyusb and pyserial are already available." exit 0 fi if ! "$PYTHON_BIN" -m pip --version >/dev/null 2>&1; then echo "Error: python3 pip is required to install flashing dependencies." >&2 exit 1 fi echo "[flash-deps] Installing pyusb and pyserial into $TARGET..." mkdir -p "$TARGET" "$PYTHON_BIN" -m pip install --disable-pip-version-check --no-input \ --target "$TARGET" pyusb pyserial echo "[flash-deps] Done."