#!/usr/bin/env bash set -euo pipefail release_root=$(cd "$(dirname "$0")" && pwd) runtime_venv=${1:-"$release_root/.venv"} python_bin=${SYNCFIX_PYTHON:-python3.12} if [ "$(uname -m)" != x86_64 ] || [ "$(uname -s)" != Linux ]; then echo 'Inference requires Linux x86_64. CPU-only verify.py works on other platforms.' >&2 exit 1 fi "$python_bin" -c 'import sys; assert sys.version_info[:2] == (3,12), "Use Python 3.12"' "$python_bin" "$release_root/verify.py" shopt -s nullglob runtime_wheels=("$release_root"/runtime/*.whl) if [ "${#runtime_wheels[@]}" -ne 1 ]; then echo 'The package must contain exactly one runtime wheel.' >&2 exit 1 fi if [ -e "$runtime_venv" ] && [ ! -f "$runtime_venv/pyvenv.cfg" ]; then echo 'Choose a new path or an existing Python virtual environment.' >&2 exit 1 fi if [ -f "$runtime_venv/pyvenv.cfg" ]; then "$runtime_venv/bin/python" -c 'import sys; assert sys.version_info[:2] == (3,12), "Choose a Python 3.12 virtual environment"' else "$python_bin" -m venv "$runtime_venv" fi "$runtime_venv/bin/python" -m pip install -r "$release_root/requirements.txt" "$runtime_venv/bin/python" -m pip install --no-deps --force-reinstall "${runtime_wheels[0]}" echo "Installed runtime in $runtime_venv" echo 'Activate the environment, then run verify.py --run.'