From bbc0721e8decc538c8c529ce7f337f9da1829d6c Mon Sep 17 00:00:00 2001 From: Delilah Date: Sun, 24 May 2026 16:14:47 -0400 Subject: [PATCH] chore: add cron script to refresh mwgg_igdb (ao) and upgrade deps Adds tools/cron_update_mwgg_igdb_ao.sh for scheduled re-installation of the ao game-index variant followed by a uv pip upgrade of all project requirements (transitive deps included). Force-reinstalls game_index/ao with --no-deps, runs an import smoke test, then upgrades requirements.txt with --upgrade --reinstall so stale transitive pins get refreshed. Co-Authored-By: Claude Opus 4.7 --- tools/cron_update_mwgg_igdb_ao.sh | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tools/cron_update_mwgg_igdb_ao.sh diff --git a/tools/cron_update_mwgg_igdb_ao.sh b/tools/cron_update_mwgg_igdb_ao.sh new file mode 100644 index 000000000..69bf4e3d7 --- /dev/null +++ b/tools/cron_update_mwgg_igdb_ao.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Cron-friendly: hard-reinstall game_index/ao, verify import, then upgrade all deps (+ transitive) via uv. +# +# Crontab example (every day at 04:00): +# 0 4 * * * /path/to/MultiworldGG/tools/cron_update_mwgg_igdb_ao.sh >> /var/log/mwgg_igdb_ao.log 2>&1 + +set -euo pipefail + +# ---- Config: edit these to match your environment ---------------------------- +REPO_ROOT="${MWGG_REPO_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}" +MWGG_VENV="${MWGG_VENV:-/path/to/mwgg_venv}" # <-- set this to your specific mwgg_venv +REQUIREMENTS="${MWGG_REQUIREMENTS:-$REPO_ROOT/requirements.txt}" +# ------------------------------------------------------------------------------ + +VENV_PY="$MWGG_VENV/bin/python" +AO_SRC="$REPO_ROOT/game_index/ao" + +log() { printf '[%s] %s\n' "$(date -Iseconds)" "$*"; } + +[[ -x "$VENV_PY" ]] || { log "ERROR: venv python not found at $VENV_PY"; exit 1; } +[[ -d "$AO_SRC" ]] || { log "ERROR: game_index/ao not found at $AO_SRC"; exit 1; } +[[ -f "$REQUIREMENTS" ]] || { log "ERROR: requirements file not found at $REQUIREMENTS"; exit 1; } + +command -v uv >/dev/null || { log "ERROR: 'uv' not on PATH"; exit 1; } + +log "Activating venv: $MWGG_VENV" +# shellcheck disable=SC1091 +source "$MWGG_VENV/bin/activate" +export VIRTUAL_ENV="$MWGG_VENV" + +log "Step 1/3: force-reinstalling mwgg_igdb (ao) from $AO_SRC" +uv pip install --python "$VENV_PY" --force-reinstall --no-deps --upgrade "$AO_SRC" + +log "Step 2/3: verifying import" +"$VENV_PY" -c 'from mwgg_igdb import GAMES_DATA, GameIndex; print(f"mwgg_igdb OK: {len(GAMES_DATA)} games")' + +log "Step 3/3: upgrading project deps (+ transitive) from $REQUIREMENTS" +# --upgrade resolves to latest compatible versions for everything in the file, +# and the resolver pulls in (and upgrades) transitive dependencies as a matter +# of course. --reinstall forces a clean install so stale transitive pins from +# a prior partial run don't linger. +uv pip install --python "$VENV_PY" --upgrade --reinstall -r "$REQUIREMENTS" + +log "Done."