-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·50 lines (40 loc) · 1.26 KB
/
install.sh
File metadata and controls
executable file
·50 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Set up a local Python environment for the Meraki reporting pipeline.
set -euo pipefail
cd "$(dirname "$0")"
PYTHON_BIN="${PYTHON_BIN:-}"
if [[ -z "$PYTHON_BIN" ]]; then
if command -v python3 >/dev/null 2>&1; then
PYTHON_BIN="$(command -v python3)"
else
echo "ERROR: python3 is required but was not found on PATH." >&2
exit 1
fi
fi
echo "Using Python: $("$PYTHON_BIN" --version 2>&1)"
if [[ ! -d ".venv" ]]; then
echo "Creating .venv..."
"$PYTHON_BIN" -m venv .venv
else
echo "Using existing .venv."
fi
VENV_PYTHON=".venv/bin/python"
if [[ ! -x "$VENV_PYTHON" ]]; then
echo "ERROR: .venv was created but .venv/bin/python is not executable." >&2
exit 1
fi
echo "Installing Python dependencies..."
"$VENV_PYTHON" -m pip install --upgrade pip
"$VENV_PYTHON" -m pip install -r requirements.txt pytest
if [[ ! -f ".env" && -f ".env.example" ]]; then
echo "Creating .env from .env.example. Add MERAKI_API_KEY before running a full API collection."
cp .env.example .env
else
echo "Leaving existing .env untouched."
fi
echo "Running test suite..."
"$VENV_PYTHON" -m pytest -q
echo ""
echo "Install complete."
echo "Run reports from existing backups: ./run.sh --report-only --no-ai-review --no-open"
echo "Run full collection: ./run.sh"