-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·70 lines (57 loc) · 2.03 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·70 lines (57 loc) · 2.03 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
64
65
66
67
68
69
70
#!/usr/bin/env bash
# ArrowCode - 1-click installer
# Creates a venv, installs requirements, and prepares run.sh.
set -e
ARROW_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ARROW_ROOT"
# ---------- helpers ----------
c_bold="\033[1m"
c_dim="\033[2m"
c_green="\033[32m"
c_red="\033[31m"
c_cyan="\033[36m"
c_reset="\033[0m"
banner() {
echo -e "${c_cyan}${c_bold}"
echo " ___ "
echo " / _ \ _ _ _ __ __ __ ___ _ __ __ __"
echo " / /_)/ | | | || '__|\ \ / // _ \| '__|\ \/ /"
echo "/ ___/| |_| || | \ V /| __/| | > < "
echo "\/ \__,_||_| \ / \___||_| /_/\_\\ "
echo " |_| "
echo -e "${c_reset}"
}
fail() { echo -e "${c_red}[ERROR]${c_reset} $1" >&2; exit 1; }
info() { echo -e "${c_green}[INFO]${c_reset} $1"; }
banner
# ---------- 1. Python version check ----------
info "Checking Python environment..."
if ! command -v python3 >/dev/null 2>&1; then
fail "Python 3 is not installed. Install Python 3.10+ and re-run."
fi
PY_MAJOR="$(python3 -c 'import sys;print(sys.version_info[0])')"
PY_MINOR="$(python3 -c 'import sys;print(sys.version_info[1])')"
if [ "$PY_MAJOR" -lt 3 ] || { [ "$PY_MAJOR" -eq 3 ] && [ "$PY_MINOR" -lt 10 ]; }; then
fail "Python 3.10+ required (found 3.${PY_MINOR}). Please upgrade."
fi
info "Python 3.${PY_MINOR} detected."
# ---------- 2. Virtual environment ----------
if [ ! -d "venv" ]; then
info "Creating virtual environment at ./venv ..."
python3 -m venv venv
fi
# ---------- 3. Pip install ----------
info "Upgrading pip ..."
# shellcheck disable=SC1091
source venv/bin/activate
python -m pip install --upgrade pip --quiet
info "Installing requirements.txt (this may take a minute) ..."
python -m pip install -r requirements.txt
# ---------- 4. Make run.sh executable ----------
chmod +x run.sh
chmod +x install.sh
# ---------- 5. Done ----------
echo
echo -e "${c_green}${c_bold}ArrowCode installed!${c_reset}"
echo -e "Run ${c_cyan}./run.sh${c_reset} to start."
echo