mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-21 20:12:26 +01:00
feedback_inbox: install kuhy_credit in the venv
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
The CLI imports kuhy_credit since the logo commit, but install.sh put only the package itself (--no-deps) in the venv, so every service run died with ModuleNotFoundError and no game bundle became a task. test_install.py checks one pip line per pyproject dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c439f54784
commit
e2fb7535dd
34
feedback_inbox/feedback_inbox/tests/test_install.py
Normal file
34
feedback_inbox/feedback_inbox/tests/test_install.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||||
|
"""install.sh puts every declared dependency into the venv.
|
||||||
|
|
||||||
|
The package itself is installed with --no-deps (no network at install time),
|
||||||
|
so each sibling package from pyproject's dependencies needs its own pip line.
|
||||||
|
A missing one made every service run die with ModuleNotFoundError
|
||||||
|
(kuhy_credit, 2026-11-21) and no bundle became a task.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
|
||||||
|
|
||||||
|
def _sibling_dirs() -> list[str]:
|
||||||
|
"""Return the utils subdirectory each declared dependency lives in."""
|
||||||
|
project = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"]
|
||||||
|
dirs = []
|
||||||
|
for dep in project["dependencies"]:
|
||||||
|
match = re.search(r"subdirectory=([\w-]+)", dep)
|
||||||
|
assert match, f"dependency without a utils subdirectory: {dep}"
|
||||||
|
dirs.append(match.group(1))
|
||||||
|
return dirs
|
||||||
|
|
||||||
|
|
||||||
|
def test_install_installs_every_dependency() -> None:
|
||||||
|
script = (ROOT / "install.sh").read_text()
|
||||||
|
for sub in _sibling_dirs():
|
||||||
|
assert f'install --quiet --no-deps "$UTILS_DIR/{sub}"' in script, sub
|
||||||
|
assert (ROOT.parent / sub).is_dir(), sub
|
||||||
@ -14,6 +14,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
readonly REPO_DIR
|
readonly REPO_DIR
|
||||||
|
readonly UTILS_DIR="${REPO_DIR%/*}"
|
||||||
readonly STATE_DIR="${HOME}/.local/share/feedback-inbox"
|
readonly STATE_DIR="${HOME}/.local/share/feedback-inbox"
|
||||||
readonly VENV_DIR="${STATE_DIR}/venv"
|
readonly VENV_DIR="${STATE_DIR}/venv"
|
||||||
readonly BIN_DIR="${HOME}/.local/bin"
|
readonly BIN_DIR="${HOME}/.local/bin"
|
||||||
@ -35,8 +36,12 @@ build_venv() {
|
|||||||
mkdir -p "$STATE_DIR"
|
mkdir -p "$STATE_DIR"
|
||||||
[[ -x "$VENV_DIR/bin/python" ]] || "$SYSTEM_PYTHON" -m venv "$VENV_DIR" \
|
[[ -x "$VENV_DIR/bin/python" ]] || "$SYSTEM_PYTHON" -m venv "$VENV_DIR" \
|
||||||
|| fail "could not create the venv"
|
|| fail "could not create the venv"
|
||||||
|
# One line per pyproject dependency (tests/test_install.py): the package
|
||||||
|
# itself goes in with --no-deps, so a missing line kills every run.
|
||||||
|
"$VENV_DIR/bin/pip" install --quiet --no-deps "$UTILS_DIR/kuhy_credit" \
|
||||||
|
|| fail "the kuhy_credit sibling package"
|
||||||
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" \
|
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" \
|
||||||
|| fail "feedback-inbox itself (stdlib only, no other packages)"
|
|| fail "feedback-inbox itself"
|
||||||
mkdir -p "$BIN_DIR"
|
mkdir -p "$BIN_DIR"
|
||||||
ln -sf "$VENV_DIR/bin/feedback-inbox" "$BIN_DIR/feedback-inbox"
|
ln -sf "$VENV_DIR/bin/feedback-inbox" "$BIN_DIR/feedback-inbox"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user