fix(env): parse the group_vars paths SPOT without PyYAML

The new dir handlers pulled utils.cache.yaml into the env build, which
bootstrap runs (make install-system-python) before any Python dependency
exists; on arch and manjaro, whose images ship no preinstalled PyYAML, the
.env generation died with ModuleNotFoundError and broke PKGMGR and the dev
environment jobs. Read the plain KEY: "value" entries with a stdlib line
parser instead; Jinja values and missing keys stay hard errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.8 committed 2026-07-11 03:26:13 +02:00
1 parent bc047de312
commit 63b60b00bb
3 files changed
+34 -14

No files matched your search

+8
View File
@@ -22,6 +22,14 @@ repos:
always_run: true
stages:
- pre-merge-commit
- id: make-lint
name: Run make lint (pre-push gate)
entry: make lint
language: system
pass_filenames: false
always_run: true
stages:
- pre-push
- id: make-test-main-merged
name: Run make test-main-merged (pre-push gate)
entry: make test-main-merged
+2 -3
View File
@@ -637,11 +637,10 @@ system-purge:
@bash scripts/system/purge/system.sh
.PHONY: test
# Run the full test pipeline (lint + tests).
# Run the full test pipeline.
# Note: parallel execution with fail-fast.
test: install install-lint
test: install
@bash scripts/make/parallel.sh \
lint \
test-external \
test-integration \
test-lint \
+24 -11
View File
@@ -5,19 +5,28 @@ The env layer (utils/env/handlers, exported by scripts/meta/env/load.sh) derives
the ``INFINITO_*`` env keys from it; a set env wins so callers can override.
When a tool runs outside that layer, e.g. a bare ``subprocess`` that does not
inherit the env build, the value is read straight from the group_vars SPOT, so
there is still no hardcoded literal default. Only plain-string values can be
read this way; a Jinja expression in the SPOT is a hard error.
there is still no hardcoded literal default.
The SPOT is parsed with a plain-string line parser instead of PyYAML: the env
build runs during bootstrap (make install-system-python) before any Python
dependency exists, so this module must stay stdlib-only. Only plain
``KEY: "value"`` entries can be read this way; a Jinja expression or a missing
key is a hard error.
"""
from __future__ import annotations
import os
import re
from pathlib import Path
from utils import PROJECT_ROOT
from utils.cache.yaml import load_yaml
from utils.cache.files import read_text
_GROUP_PATHS_FILE = str(PROJECT_ROOT / "group_vars" / "all" / "05_paths.yml")
_ENTRY_RE = re.compile(
r'^(?P<key>[A-Za-z_][A-Za-z0-9_]*):\s*"?(?P<value>[^"#]*)"?\s*(?:#.*)?$'
)
def read_group_path(key: str) -> str:
@@ -33,14 +42,18 @@ def read_group_path(key: str) -> str:
KeyError: the key is not defined in the SPOT.
ValueError: the value is not a plain string (e.g. a Jinja template).
"""
value = load_yaml(_GROUP_PATHS_FILE).get(key)
if value is None:
raise KeyError(f"{key} not defined in {_GROUP_PATHS_FILE}")
if not isinstance(value, str) or "{{" in value:
raise ValueError(
f"{key} in {_GROUP_PATHS_FILE} must be a plain string, got: {value!r}"
)
return value
for line in read_text(_GROUP_PATHS_FILE).splitlines():
match = _ENTRY_RE.match(line.strip())
if not match or match.group("key") != key:
continue
value = match.group("value").strip()
if not value or "{{" in value:
raise ValueError(
f"{key} in {_GROUP_PATHS_FILE} must be a plain string, "
f"got: {line.strip()!r}"
)
return value
raise KeyError(f"{key} not defined in {_GROUP_PATHS_FILE}")
def _dir_var_lib() -> str: