Skip to content

Commit

Permalink
Improve debuggability of autogenerated_files.py
Browse files Browse the repository at this point in the history
Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Jan 4, 2025
1 parent 0c9e5a0 commit 366d667
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/autogenerate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,15 @@ def update_file(filename, content, dry_run=False):
with open(filename, "r") as f:
current_content = f.read()
if current_content != content:
filename_new = f"{filename}.new"
print(
f"Autogenerated file {filename} needs updating. Have you called scripts/autogenerated.py?"
f"Autogenerated file {filename} needs updating. Have you called scripts/autogenerated.py?",
file=sys.stderr,
)
print(f"Writing new version to {filename_new}", file=sys.stderr)
with open(filename_new, "w") as f:
f.write(content)
subprocess.run(["diff", filename, filename_new])
exit(1)


Expand Down

0 comments on commit 366d667

Please sign in to comment.