-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxima-cli
More file actions
executable file
·39 lines (32 loc) · 1012 Bytes
/
Copy pathproxima-cli
File metadata and controls
executable file
·39 lines (32 loc) · 1012 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
PYTHON_BIN=""
if [[ -x "$ROOT_DIR/.venv/bin/python" ]]; then
PYTHON_BIN="$ROOT_DIR/.venv/bin/python"
elif command -v python3 >/dev/null 2>&1; then
PYTHON_BIN="$(command -v python3)"
else
echo "python3 is required but not found in PATH."
exit 1
fi
bootstrap_env() {
echo "Local environment is missing dependencies."
read -r -p "Create .venv and install project now? [Y/n]: " answer
answer="${answer:-Y}"
if [[ ! "$answer" =~ ^([Yy]|[Дд][Аа]?)$ ]]; then
echo "Cancelled."
exit 1
fi
if [[ ! -x "$ROOT_DIR/.venv/bin/python" ]]; then
"$PYTHON_BIN" -m venv "$ROOT_DIR/.venv"
fi
"$ROOT_DIR/.venv/bin/python" -m pip install --upgrade pip
"$ROOT_DIR/.venv/bin/pip" install -e ".[dev]"
}
if ! "$PYTHON_BIN" -c "import proxima.cli.tool" >/dev/null 2>&1; then
bootstrap_env
PYTHON_BIN="$ROOT_DIR/.venv/bin/python"
fi
exec "$PYTHON_BIN" -m proxima.cli.tool "$@"