mirror of
https://github.com/saymrwulf/QuantumLearning.git
synced 2026-05-14 20:58:00 +00:00
96 lines
1.9 KiB
Bash
Executable file
96 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
INSTALL_BROWSER=1
|
|
RUN_VALIDATION=0
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: bash ./scripts/bootstrap_mac.sh [--skip-browser] [--run-validation]
|
|
|
|
Bootstrap QuantumLearning on a Mac using only repo-local runtime paths.
|
|
|
|
Options:
|
|
--skip-browser Skip installing the project-local Playwright Chromium runtime.
|
|
--run-validation Run the full validation suite after bootstrapping.
|
|
-h, --help Show this help.
|
|
EOF
|
|
}
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--skip-browser)
|
|
INSTALL_BROWSER=0
|
|
shift
|
|
;;
|
|
--run-validation)
|
|
RUN_VALIDATION=1
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
resolve_python() {
|
|
if command -v python3.12 >/dev/null 2>&1; then
|
|
echo "python3.12"
|
|
return 0
|
|
fi
|
|
|
|
if command -v python3 >/dev/null 2>&1; then
|
|
if python3 -c 'import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)'; then
|
|
echo "python3"
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
return 1
|
|
}
|
|
|
|
if ! PYTHON_BIN="$(resolve_python)"; then
|
|
cat <<'EOF' >&2
|
|
Python 3.12 is required.
|
|
|
|
Install it first, then re-run this script.
|
|
Typical options on macOS:
|
|
brew install python@3.12
|
|
or install Python 3.12 from python.org
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
cd "$ROOT_DIR"
|
|
|
|
if [[ ! -d "$ROOT_DIR/.venv" ]]; then
|
|
"$PYTHON_BIN" -m venv "$ROOT_DIR/.venv"
|
|
fi
|
|
|
|
source "$ROOT_DIR/.venv/bin/activate"
|
|
python -m pip install --upgrade pip
|
|
python -m pip install -e ".[dev]"
|
|
|
|
if [[ "$INSTALL_BROWSER" -eq 1 ]]; then
|
|
PLAYWRIGHT_BROWSERS_PATH="$ROOT_DIR/.playwright-browsers" python -m playwright install chromium
|
|
fi
|
|
|
|
if [[ "$RUN_VALIDATION" -eq 1 ]]; then
|
|
bash "$ROOT_DIR/scripts/run_validation.sh"
|
|
fi
|
|
|
|
cat <<EOF
|
|
Bootstrap complete.
|
|
|
|
Next steps:
|
|
bash ./scripts/app.sh status
|
|
bash ./scripts/app.sh validate --quick
|
|
bash ./scripts/app.sh start --open
|
|
EOF
|