mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
Three modules reimplemented what utils.cache already offers, and each paid
for it with a suppression.
test_compose_override_services_defined carried a yaml.SafeLoader subclass
whose only job was to swallow compose's own tags, plus a noqa for the
yaml.load rule it then tripped. load_yaml_any handles !override and !reset
already, so the loader and the suppression both go.
test_compose_bind_sources_exist read default.env directly and argued in a
nocheck marker that once per session is fine. Reading it through
utils.cache.files makes the argument unnecessary.
test_gpu_gate loaded the role's vars and meta files with raw yaml over
hand-assembled paths; it now uses load_yaml with ROLE_FILE_VARS_MAIN and
ROLE_FILE_META_SERVICES, the way 50a13c755b did for the playwright
multipliers.
gpu_count drops a noqa ruff no longer raises, and the development env module
an import nothing uses, which lint-python rejects.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from utils.distros import distro_names
|
|
|
|
VALID_DISTROS: tuple[str, ...] = distro_names()
|
|
|
|
|
|
def compose_file_args() -> list[str]:
|
|
"""Compose `-f` flags shared by up and down flows.
|
|
|
|
Each override is gated on the resource it needs being present, not on the
|
|
instance slot: an override whose `:?` guard is unsatisfied would abort the
|
|
stack outright, so a checkout that was never handed a shared git dir or
|
|
cache network simply does not layer that file in.
|
|
"""
|
|
from .profile import Profile
|
|
|
|
profile = Profile()
|
|
out = ["-f", "compose.yml"]
|
|
if profile.shared_git_dir():
|
|
out += ["-f", "compose/worktree.override.yml"]
|
|
if profile.cache_stack_enabled():
|
|
out += ["-f", "compose/cache.override.yml"]
|
|
if profile.shared_cache_network():
|
|
out += ["-f", "compose/cache.shared.override.yml"]
|
|
if (os.environ.get("INFINITO_PUBLISH_PORTS") or "").strip().lower() == "false":
|
|
out += ["-f", "compose/noports.override.yml"]
|
|
out += ["-f", "i18n/compose.override.yml"]
|
|
return out
|
|
|
|
|
|
def resolve_distro() -> str:
|
|
"""Return INFINITO_DISTRO; raise SystemExit if missing or invalid."""
|
|
distro = os.environ["INFINITO_DISTRO"].strip()
|
|
if not distro:
|
|
raise SystemExit(
|
|
"INFINITO_DISTRO is not set. Run 'make dotenv' (or source scripts/meta/env/load.sh) "
|
|
f"or export INFINITO_DISTRO=<{'|'.join(VALID_DISTROS)}> "
|
|
"before invoking cli.administration.deploy.development."
|
|
)
|
|
if distro not in VALID_DISTROS:
|
|
raise SystemExit(
|
|
f"INFINITO_DISTRO={distro!r} is not a valid distro. "
|
|
f"Valid: {', '.join(VALID_DISTROS)}."
|
|
)
|
|
return distro
|