From e27ecc0a3a9d65214f69f4d88d63bb7457327687 Mon Sep 17 00:00:00 2001 From: XyleMora Date: Mon, 9 Nov 2026 23:26:14 +0200 Subject: [PATCH] fix(release): print ASCII from set_version.py, and UTF-8 on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Windows runner's console is cp1252, which can't encode "→": the script wrote the version into the files, then failed printing what it changed, and with it the Windows build of the v0.2.0 release. It now prints "->" and switches its own output to UTF-8 (errors replaced), so no message can fail the build. Co-Authored-By: Claude Opus 5.5 --- tools/set_version.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/set_version.py b/tools/set_version.py index 2a4b9f7..03a1315 100755 --- a/tools/set_version.py +++ b/tools/set_version.py @@ -43,13 +43,18 @@ def set_version(version: str, root: Path = ROOT) -> list[str]: if not m: raise ValueError(f"no {what} found in {rel}") if m.group(2) != version: - changed.append(f"{what}: {m.group(2)} → {version}") + changed.append(f"{what}: {m.group(2)} -> {version}") text = text[: m.start(2)] + version + text[m.end(2) :] path.write_text(text, encoding="utf-8") return changed def main() -> int: + # Windows runners print through cp1252, which can't encode every character + # (a "→" once failed the Windows release build after the files were written). + for stream in (sys.stdout, sys.stderr): + if hasattr(stream, "reconfigure"): + stream.reconfigure(encoding="utf-8", errors="replace") if len(sys.argv) != 2: print(__doc__.strip().splitlines()[2].strip(), file=sys.stderr) return 2