-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_python_locks.sh
More file actions
executable file
·39 lines (33 loc) · 1.1 KB
/
Copy pathupdate_python_locks.sh
File metadata and controls
executable file
·39 lines (33 loc) · 1.1 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
#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PYTHON_BIN="${TREX_WEBUI_LOCK_PYTHON:-$PROJECT_ROOT/.venv/bin/python}"
UV_BIN=""
die() {
printf 'error: %s\n' "$*" >&2
exit 1
}
[[ -x "$PYTHON_BIN" ]] || die "dependency-complete project Python not found: $PYTHON_BIN"
"$PYTHON_BIN" -c \
'import sys; raise SystemExit(sys.version_info[:2] != (3, 11))' ||
die "Python lock generation requires Python 3.11"
UV_BIN="$(dirname -- "$PYTHON_BIN")/uv"
[[ -x "$UV_BIN" ]] ||
die "uv is not installed beside $PYTHON_BIN"
cd "$PROJECT_ROOT"
"$UV_BIN" pip compile \
--custom-compile-command scripts/update_python_locks.sh \
--generate-hashes \
--output-file=apps/api/requirements.lock \
--python-version 3.11 \
--quiet \
apps/api/requirements.txt
"$UV_BIN" pip compile \
--custom-compile-command scripts/update_python_locks.sh \
--generate-hashes \
--output-file=apps/api/requirements-dev.lock \
--python-version 3.11 \
--quiet \
apps/api/requirements-dev.txt
printf 'Python lock files updated.\n'