-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
32 lines (28 loc) · 1.01 KB
/
Copy pathinstall.sh
File metadata and controls
32 lines (28 loc) · 1.01 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
#!/usr/bin/env bash
# install.sh — POSIX entry point for the per-project installer.
#
# The installer itself is install.py: one cross-platform implementation
# instead of one per shell. This script only locates a working Python and
# hands over, so `bash install.sh` keeps working everywhere it used to.
#
# Windows without Git Bash: python install.py [options]
#
# Usage:
# bash install.sh [--project-root PATH] [--with-gstack] [--gstack-ref REF] [--dry-run]
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PY="$(bash "$SCRIPT_DIR/tools/ai_docs/find_python.sh" 2>/dev/null || true)"
if [ -z "$PY" ]; then
for CANDIDATE in python3 python py; do
if command -v "$CANDIDATE" >/dev/null 2>&1 &&
"$CANDIDATE" -c "import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1)" 2>/dev/null; then
PY="$CANDIDATE"
break
fi
done
fi
if [ -z "$PY" ]; then
echo "ERROR: no Python 3.8+ found. Install Python and retry." >&2
exit 1
fi
exec env PYTHONIOENCODING=utf-8 "$PY" "$SCRIPT_DIR/install.py" "$@"