-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlauncher2.sh
More file actions
60 lines (48 loc) · 2.14 KB
/
launcher2.sh
File metadata and controls
60 lines (48 loc) · 2.14 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
#!/usr/bin/env bash
# ==============================================================================
# launcher2 - uv-based launcher for GM-TestFramework
# ==============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export UV_PROJECT_ENVIRONMENT="$SCRIPT_DIR/.venv"
export UV_CACHE_DIR="${UV_CACHE_DIR:-$SCRIPT_DIR/.uv/.uv_cache}"
_LAUNCHER_UV_VERSION="0.10.8"
# Check if uv is already available on PATH
if ! command -v uv &> /dev/null; then
# uv not on PATH, check local install
UV_INSTALL_DIR="$SCRIPT_DIR/.uv/bin"
export PATH="$UV_INSTALL_DIR:$PATH"
if ! command -v uv &> /dev/null; then
# Install uv locally
echo "uv not found, installing to \"$UV_INSTALL_DIR\"..."
mkdir -p "$UV_INSTALL_DIR"
if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
# Windows (Git Bash)
UV_ZIP="$UV_INSTALL_DIR/uv-windows.zip"
if [[ "$PROCESSOR_ARCHITECTURE" == "ARM64" ]] || [[ "$(uname -m)" == "aarch64" ]]; then
UV_ARCH="aarch64-pc-windows-msvc"
else
UV_ARCH="x86_64-pc-windows-msvc"
fi
curl -LsSf "https://github.com/astral-sh/uv/releases/download/$_LAUNCHER_UV_VERSION/uv-$UV_ARCH.zip" -o "$UV_ZIP" || {
echo "Failed to download uv release."
exit 1
}
unzip -q "$UV_ZIP" -d "$UV_INSTALL_DIR"
rm -f "$UV_ZIP"
else
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="$UV_INSTALL_DIR" UV_NO_MODIFY_PATH=1 sh || {
echo "Failed to install uv."
exit 1
}
fi
chmod +x "$UV_INSTALL_DIR/uv" 2>/dev/null || true
if [[ -x "$UV_INSTALL_DIR/uv" ]] || [[ -x "$UV_INSTALL_DIR/uv.exe" ]]; then
echo "uv installed successfully."
else
echo "uv installation failed. Please install uv manually: https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
fi
fi
uv run python "$SCRIPT_DIR/launcher.py" "$@"