Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s

This commit is contained in:
2026-12-03 18:56:28 +01:00
parent 20c83f861f
commit 1ca2c8efe0
142 changed files with 1095 additions and 933 deletions
+9 -8
View File
@@ -88,6 +88,7 @@ clone, or the default branch cannot be read; or, after the rest of the report, w
build-release's archive cannot be read.
"""
import functools
from collections.abc import Mapping
import os
import pathlib
import re
@@ -119,7 +120,7 @@ UNMERGED = [
]
def main(argv: list[str], home: pathlib.Path) -> int:
def main(argv: list[str], home: pathlib.Path, env: Mapping[str, str]) -> int:
if argv[:1] in (["-h"], ["--help"]):
print(__doc__.strip())
return 0
@@ -133,10 +134,10 @@ def main(argv: list[str], home: pathlib.Path) -> int:
default, note = found
if note:
print(f"score-outcomes: {note}", file=sys.stderr)
results = read_results(default, home)
results = read_results(default, home, env)
if isinstance(results, Failure):
return failed(results)
anchored = read_anchors(home)
anchored = read_anchors(home, env)
reversal = read_reversals(home)
print(report_text(results, anchored, dict(zip(GIVEN, map(int, argv))) if argv else None, reversal))
unread = [found for found in (anchored, reversal) if isinstance(found, Failure)]
@@ -167,9 +168,9 @@ def failed(failure: Failure) -> int:
return 1
def read_anchors(home: pathlib.Path) -> Anchors | Failure:
def read_anchors(home: pathlib.Path, env: Mapping[str, str]) -> Anchors | Failure:
"""The project's anchors as they stand in the store its config names, so a branch that edits them shows its edit; none where it keeps none."""
config = located(None, home)
config = located(None, home, env)
if isinstance(config, Failure):
return config
text = store(config, "score-anchors").read()
@@ -184,17 +185,17 @@ def read_reversals(home: pathlib.Path) -> list[str] | Failure:
return reversal_lines(project_archive(str(pathlib.Path(common.strip()).parent), home, os.environ))
def read_results(default: str, home: pathlib.Path) -> list[Result] | Failure:
def read_results(default: str, home: pathlib.Path, env: Mapping[str, str]) -> list[Result] | Failure:
"""What each chunk on the default branch's first-parent line measured."""
if partial := full_history():
return partial
if why := unsupported(None, home):
if why := unsupported(None, home, env):
return Failure(f"this project is not supported yet: {why}")
root = top()
if isinstance(root, Failure):
return root
run = functools.partial(git, cwd=root)
templates = title_templates(None, home)
templates = title_templates(None, home, env)
if isinstance(templates, Failure):
return templates
chunks = branch_chunks(default, run, templates)