Files
hermes-agent/scripts/hermes-python
alt-glitch 94b7deed4b fix(dev): hermes-python takes the HERMES_PYTHON shortcut only on a runner
Outside CI, HERMES_PYTHON is often inherited from a wrapped hermes (the TUI
sets it for its children) and names a release venv without the dev tools.
scripts/hermes-python ran that interpreter for any unactivated shell, so
just check, just fix and the lefthook ruff hook could run on it instead of
the checkout's environment. The shortcut now also needs
GITHUB_ACTIONS=true, the only caller the header names.

Co-authored-by: Bear Huddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-09 17:58:41 +05:30

16 lines
730 B
Bash
Executable File

#!/usr/bin/env bash
# Run Python in this checkout's environment: `scripts/hermes-python ARGS...`.
#
# A GitHub Actions job runs the interpreter setup-pm exported as HERMES_PYTHON,
# so a recipe never re-runs setup on a runner. Anywhere else HERMES_PYTHON may
# be inherited from a wrapped `hermes` (a release venv without the dev tools),
# so scripts/run-in-hermes-env applies (and if stale, syncs) the environment
# `source ./activate` gives a shell.
set -euo pipefail
if [ "${GITHUB_ACTIONS:-}" = true ] && [ -z "${__HERMES_ACTIVATED:-}" ] && [ -n "${HERMES_PYTHON:-}" ] \
&& [ -x "$HERMES_PYTHON" ]; then
exec "$HERMES_PYTHON" "$@"
fi
exec "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/run-in-hermes-env" python "$@"