mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 04:06:42 +00:00
The README generator read its author URL out of the ## Credits sections it
writes itself. .mailmap now folds every address a person commits under into
their @infinito.nexus one, whose local part names their social profile, and
that profile becomes the single point of truth for an author.
utils/meta/identity.py parses .mailmap rather than shelling out to
git check-mailmap, which refuses the worktree the test container mounts.
Cross-checked against git over all 14 identities in the history: no
disagreement.
A new env handler carries the committing identity into the container, which
mounts the checkout but not the contributor's git configuration. Without it
both new tests would skip exactly where they are meant to fire:
* tests/integration/meta/test_commit_identity.py fails when the configured
address does not fold, and prints the .mailmap line to add.
* tests/external/repository/test_author_profile.py probes that profile
live, behind a canary so an unreachable instance is not reported as a
missing profile.
Both look at the current address only. Probing every declared author would be
red for people who have not created a profile yet, and a suite that is red for
someone else's omission stops being read.
Marko Pjevac is declared as a role author but has no address here, so his
Credits line stays unlinked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""The people the roles name as their authors.
|
|
|
|
``galaxy_info.author`` is where a role records who implemented it, so that is
|
|
where the names are read. A role may credit more than one person, comma
|
|
separated.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from functools import lru_cache
|
|
from pathlib import Path
|
|
|
|
from utils.cache.files import PROJECT_ROOT
|
|
from utils.cache.yaml import load_yaml
|
|
from utils.meta.role.names import ROLES_DIR
|
|
from utils.roles.mapping import ROLE_FILE_META_MAIN
|
|
|
|
|
|
def role_authors(role_dir: Path) -> tuple[str, ...]:
|
|
"""Return the people ``role_dir`` names as its authors.
|
|
|
|
Args:
|
|
role_dir: the role's directory.
|
|
"""
|
|
meta = role_dir / ROLE_FILE_META_MAIN
|
|
if not meta.is_file():
|
|
return ()
|
|
declared = ((load_yaml(str(meta)) or {}).get("galaxy_info") or {}).get("author")
|
|
if not declared:
|
|
return ()
|
|
return tuple(part.strip() for part in str(declared).split(",") if part.strip())
|
|
|
|
|
|
@lru_cache(maxsize=1)
|
|
def author_names(root: str = str(PROJECT_ROOT)) -> tuple[str, ...]:
|
|
"""Return every declared role author, sorted and without duplicates.
|
|
|
|
Args:
|
|
root: repository root, as a string so the cache key stays hashable.
|
|
"""
|
|
found = set()
|
|
for path in sorted(Path(root, ROLES_DIR).iterdir()):
|
|
if path.is_dir():
|
|
found.update(role_authors(path))
|
|
return tuple(sorted(found))
|