Commit e405fa2
committed
fix: make the schema codegen host-independent
The generated modules are checked in, and `make gen-check` asserts that regenerating
them reproduces the committed artifact. Two host dependencies broke that:
- `gen_schema.py:179` and `gen_meta.py:59` interpolate a `Path` into the generated
header, so the path uses `os.sep` and a non-POSIX host emits `schema\schema.json`
where the committed artifact says `schema/schema.json`.
- both generators run ruff via `subprocess.run(..., text=True)` without an encoding,
so the child's UTF-8 output is decoded with `locale.getpreferredencoding(False)`.
When ruff fails, the decode fails first and the message becomes "stream did not
contain valid UTF-8", discarding the actual reason -- and hiding the header
mismatch, since that error is raised before the artifact comparison.
`as_posix()` emits `/` on every host, and `encoding="utf-8"` is what both files
already pass to every read_text/write_text they perform.
tests/test_gen_all.py goes from 1 failed / 20 passed to 21 passed; reverting only
these two scripts restores the failure.1 parent 9d07d78 commit e405fa2
2 files changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
0 commit comments