From df39ac33d2771205b236f072994d5426548c9dbb Mon Sep 17 00:00:00 2001 From: JCW Date: Tue, 31 Mar 2026 16:38:33 +0100 Subject: [PATCH] Fix pr comments --- scripts/codegen/update_codegen_stamp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/codegen/update_codegen_stamp.py b/scripts/codegen/update_codegen_stamp.py index 54b0598626..290aee8232 100644 --- a/scripts/codegen/update_codegen_stamp.py +++ b/scripts/codegen/update_codegen_stamp.py @@ -27,6 +27,9 @@ def compute_combined_hash(input_files: list[str]) -> str: """ parts = [] for filepath in input_files: + if not Path(filepath).exists(): + print(f"Error: input file not found: {filepath}", file=sys.stderr) + sys.exit(1) file_hash = hashlib.sha256(Path(filepath).read_bytes()).hexdigest() parts.append(file_hash) @@ -39,7 +42,7 @@ def read_stamp_hash(stamp_file: str) -> str: path = Path(stamp_file) if not path.exists(): return "" - for line in path.read_text().splitlines(): + for line in path.read_text(encoding="utf-8").splitlines(): if line.startswith("COMBINED_HASH="): return line.split("=", 1)[1] return "" @@ -67,7 +70,7 @@ def main(): sys.exit(1) # --update - with open(stamp_file, "w") as fp: + with open(stamp_file, "w", encoding="utf-8") as fp: fp.write( "# Auto-generated by protocol autogen - do not edit manually.\n" "# This file tracks input hashes to avoid unnecessary code regeneration.\n"