-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·63 lines (54 loc) · 1.44 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·63 lines (54 loc) · 1.44 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
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
# ASPL one-command install. Creates a virtualenv, installs ASPL, and (optionally)
# starts a node.
#
# ./install.sh # install into ./.venv
# ./install.sh --dev # install with dev/test extras
# ./install.sh --run # install, then start the node
#
set -euo pipefail
cd "$(dirname "$0")"
PYTHON="${PYTHON:-python3}"
VENV="${ASPL_VENV:-.venv}"
DEV=0
RUN=0
for arg in "$@"; do
case "$arg" in
--dev) DEV=1 ;;
--run) RUN=1 ;;
*) echo "unknown option: $arg"; exit 2 ;;
esac
done
if ! command -v "$PYTHON" >/dev/null 2>&1; then
echo "error: $PYTHON not found. Install Python 3.10+ first." >&2
exit 1
fi
echo "==> Creating virtualenv in $VENV"
"$PYTHON" -m venv "$VENV"
# shellcheck disable=SC1091
source "$VENV/bin/activate"
echo "==> Upgrading pip"
pip install --quiet --upgrade pip
if [ "$DEV" -eq 1 ]; then
echo "==> Installing ASPL (with dev extras)"
pip install --quiet -e ".[dev]"
else
echo "==> Installing ASPL"
pip install --quiet -e .
fi
if [ ! -f .env ] && [ -f .env.example ]; then
cp .env.example .env
echo "==> Wrote default .env (from .env.example)"
fi
echo ""
echo "ASPL installed. Activate the environment with:"
echo " source $VENV/bin/activate"
echo "Then start a node with:"
echo " aspl-server"
echo "and drive it with the CLI:"
echo " aspl register --name my-agent"
echo ""
if [ "$RUN" -eq 1 ]; then
echo "==> Starting ASPL node (Ctrl-C to stop)"
exec aspl-server
fi