47 lines
1.1 KiB
Bash
47 lines
1.1 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Simple launcher: creates/uses .venv, installs deps, runs GUI
|
||
|
|
|
||
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
|
||
|
|
echo "[run.sh] Working directory: $DIR"
|
||
|
|
|
||
|
|
# Choose Python
|
||
|
|
if command -v python3 >/dev/null 2>&1; then
|
||
|
|
PY=python3
|
||
|
|
elif command -v python >/dev/null 2>&1; then
|
||
|
|
PY=python
|
||
|
|
else
|
||
|
|
echo "Error: python3 (or python) not found in PATH" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Create venv if missing
|
||
|
|
if [ ! -d "$DIR/.venv" ]; then
|
||
|
|
echo "[run.sh] Creating virtual environment (.venv)"
|
||
|
|
"$PY" -m venv "$DIR/.venv"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Activate venv
|
||
|
|
echo "[run.sh] Activating .venv"
|
||
|
|
# shellcheck disable=SC1091
|
||
|
|
source "$DIR/.venv/bin/activate"
|
||
|
|
|
||
|
|
# Upgrade installer tooling
|
||
|
|
echo "[run.sh] Upgrading pip/setuptools/wheel"
|
||
|
|
python -m pip install --upgrade pip setuptools wheel >/dev/null
|
||
|
|
|
||
|
|
# Install dependencies
|
||
|
|
if [ -f "$DIR/requirements.txt" ]; then
|
||
|
|
echo "[run.sh] Installing requirements"
|
||
|
|
pip install -r "$DIR/requirements.txt"
|
||
|
|
else
|
||
|
|
echo "[run.sh] No requirements.txt found, skipping dependency install"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Run the app (forward any arguments)
|
||
|
|
echo "[run.sh] Launching GLaDOS GUI"
|
||
|
|
exec python "$DIR/glados_gui.py" "$@"
|
||
|
|
|