mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Adds INFINITO_VENV_DIR=/opt/venvs/infinito to default.env (registered
in passthrough's STATIC_KEYS so make dotenv propagates it to .env) and
threads it through the build chain: compose.yml forwards it as a build
arg; scripts/image/push.sh asserts and --build-args it; the Dockerfile
declares the matching ARG/ENV and derives PYTHON/PIP/PATH from the
variable. scripts/meta/env/python.sh now prefers the value when set
before its fallback discovery so the SPOT is effective in env
resolution.
Fixes the dev image build regression where 'infinito --version' in
scripts/docker/entry.sh exited 127. Root cause: the Dockerfile RUN
SHELL uses bash -lc, which sources /etc/profile and resets PATH to
the Debian default, dropping ${INFINITO_VENV_DIR}/bin from it. The
fix invokes the script via its absolute path "${INFINITO_VENV_DIR}/bin/infinito"
so the post-install version check no longer depends on a PATH that
the login-shell init has just clobbered.
scripts/lint/wrapper.sh's existing PATH-reset note now references the
variable instead of the literal path. test-install-make.yml and
test-install-pkgmgr.yml read INFINITO_VENV_DIR from default.env up
front, pass it into their pkgmgr containers, and source the venv
activate script via the variable.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
#
|
|
# SPOT for venv + Python interpreter resolution. Exports VENV, PYTHON,
|
|
# PIP, PYTHONPATH. Sourced; re-entrant.
|
|
|
|
VENV_NAME=infinito
|
|
|
|
if [[ -z "${VENV:-}" && -n "${INFINITO_VENV_DIR:-}" ]]; then
|
|
VENV="${INFINITO_VENV_DIR}"
|
|
fi
|
|
|
|
if [[ -z "${VENV:-}" ]]; then
|
|
for _venv_candidate in "/opt/venvs/${VENV_NAME}" "${HOME}/.venvs/${VENV_NAME}"; do
|
|
if [[ -x "${_venv_candidate}/bin/python" ]]; then
|
|
VENV="${_venv_candidate}"
|
|
break
|
|
fi
|
|
done
|
|
unset _venv_candidate
|
|
fi
|
|
|
|
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
|
|
VENV_BASE="$(dirname "${VIRTUAL_ENV}")"
|
|
elif [[ -d /opt && -w /opt ]]; then
|
|
VENV_BASE=/opt/venvs
|
|
else
|
|
VENV_BASE="${HOME}/.venvs"
|
|
fi
|
|
|
|
VENV_FALLBACK="${VENV_BASE%/}/${VENV_NAME}"
|
|
VENV="${VENV:-${VIRTUAL_ENV:-${VENV_FALLBACK}}}"
|
|
|
|
if [[ -x "${VENV}/bin/python" ]]; then
|
|
PYTHON="${VENV}/bin/python"
|
|
elif command -v python3 >/dev/null 2>&1; then
|
|
PYTHON=python3
|
|
else
|
|
echo "detect.sh: no python3 on PATH and no venv at ${VENV}/bin/python" >&2
|
|
# shellcheck disable=SC2317
|
|
return 1 2>/dev/null || exit 1
|
|
fi
|
|
|
|
PIP="${PYTHON} -m pip"
|
|
PYTHONPATH="${PYTHONPATH:-.}"
|
|
|
|
export VENV PYTHON PIP PYTHONPATH
|