diff --git a/scripts/autogenerate_files.py b/scripts/autogenerate_files.py index 99279dfa1..2b3a812f3 100644 --- a/scripts/autogenerate_files.py +++ b/scripts/autogenerate_files.py @@ -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)