Skip to content

Commit 1096a38

Browse files
committed
Add build-sequence-suummary.json
Machine readable version of the current markdown table Useful in pipeline environments to filter skipped or prebuilt packages from a subsequent twine publish Signed-off-by: Pris Nasrat <[email protected]>
1 parent 67a0a4e commit 1096a38

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

e2e/test_build_order.sh

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ $OUTDIR/sdists-repo/downloads/pbr-*.tar.gz
5151
$OUTDIR/work-dir/logs/stevedore-*.log
5252
$OUTDIR/work-dir/logs/setuptools-*.log
5353
$OUTDIR/work-dir/logs/pbr-*.log
54+
55+
$OUTDIR/work-dir/build-sequence-summary.md
56+
$OUTDIR/work-dir/build-sequence-summary.json
5457
"
5558

5659
pass=true

src/fromager/commands/build.py

+15
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ class BuildSequenceEntry:
4444
wheel_filename: pathlib.Path
4545
skipped: bool = False
4646

47+
@staticmethod
48+
def dict_factory(x):
49+
return {
50+
k: str(v) if isinstance(v, pathlib.Path | Version) else v for (k, v) in x
51+
}
52+
4753
def __lt__(self, other):
4854
if not isinstance(other, BuildSequenceEntry):
4955
return NotImplemented
@@ -278,6 +284,15 @@ def _summary(ctx: context.WorkContext, entries: list[BuildSequenceEntry]) -> Non
278284
console = rich.console.Console(file=f, width=sys.maxsize)
279285
console.print(*output, sep="\n\n")
280286

287+
with open(ctx.work_dir / "build-sequence-summary.json", "w", encoding="utf-8") as f:
288+
json.dump(
289+
[
290+
dataclasses.asdict(e, dict_factory=BuildSequenceEntry.dict_factory)
291+
for e in entries
292+
],
293+
f,
294+
)
295+
281296

282297
def _create_table(entries: list[BuildSequenceEntry], **table_kwargs) -> Table:
283298
table = Table(**table_kwargs)

0 commit comments

Comments
 (0)