-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathg023.sh
More file actions
29 lines (24 loc) · 902 Bytes
/
Copy pathg023.sh
File metadata and controls
29 lines (24 loc) · 902 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
#!/usr/bin/env bash
# g023 Code launcher (Linux / macOS / WSL)
# Usage from any project folder:
# /path/to/g023-code/g023.sh
# or after adding to PATH / alias: g023
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export G023_HOME="${SCRIPT_DIR}"
export G023_PROJECT_ROOT="$(pwd)"
# A venv created by installer.sh wins over whatever python is on PATH: it is the
# one interpreter we know has the dependencies.
if [ -x "${SCRIPT_DIR}/.venv/bin/python" ]; then
PYTHON="${SCRIPT_DIR}/.venv/bin/python"
elif command -v python3 >/dev/null 2>&1; then
PYTHON=python3
elif command -v python >/dev/null 2>&1; then
PYTHON=python
else
echo "Error: Python 3 is required but not found. Run ./installer.sh first." >&2
exit 1
fi
# Ensure the package is importable
export PYTHONPATH="${SCRIPT_DIR}${PYTHONPATH:+:$PYTHONPATH}"
exec "${PYTHON}" -m g023_code "$@"