tooling: require exactly one layout file in resource_inventory #638
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/644"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-22T17:16:33Z.
Change
tools/resource_inventory.pychose the layout withlayout, = root.glob("layout*.xml"). A package with no layout file, two layout files, or a directory whose name matches the pattern ended inValueErrororPermissionErrorwith a traceback.verify_build.py, which reads the same package, filters to regular files and reportsexpected exactly one ... found Nthroughparser.error(exit 2). This uses the same filter and message.Independent problem, no linked issue.
Verification
Commit under test:
a6668beonb03f754, Windows 11, Python 3.12.10.CLI on three synthetic packages, base vs this branch (
python -B tools/resource_inventory.py <dir>):ValueError: not enough values to unpack (expected 1, got 0), exit 1expected exactly one layout*.xml file in <dir>, found 0, exit 2layout_a.xml+layout_b.xmlValueError: too many values to unpack (expected 1), exit 1... found 2, exit 2layout_directory.xmlonlyPermissionError: [Errno 13], exit 1... found 0, exit 2New
check_inventory_layout_selectionintests/layout_chunks_check.pyruns the CLI on a directory-only package and on a two-file-plus-directory package and requires exit 2, the message and no traceback.PermissionError, exit 1.layout chunk summary ok, exit 0.Evidence and follow-up
Synthetic empty files only. The single-valid-layout path is not exercised by the new check; it is the unchanged behavior of the existing inventory run, which needs game files.
Checklist
AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T17:35:31Z.
Coordination note: this PR and #643 both edit
tests/layout_chunks_check.py. I checked534f673(#643) anda6668be(#644) on Windows 11 26100.9168 with Python 3.12.10:mainat8f57366.python -B tests/layout_chunks_check.pyprintslayout chunk summary ok.They can land in either order.
AI-assisted (Claude Code).