INNER CODE UNIT · Python
check_metadata
JetBrains/godot-support · godot-rd/godot_cpp_gen_main.py:114
def check_metadata(metadata: dict[Path, str]) -> int:
stale = []
for path, expected in metadata.items():
committed = path.read_text(encoding="utf-8") if path.is_file() else ""
if committed == expected:
continue
stale.append(path.name)
sys.stdout.writelines(difflib.unified_diff(
committed.splitlines(keepends=True),
expected.splitlines(keepends=True),
fromfile=f"{path.name} (committed)",
tofile=f"{path.name} (generated)",
))
if stale:
print(
f"\nThe committed {', '.join(stale)} is out of date. "
"Regenerate it with `python3 godot_cpp_gen_main.py --regenerate-metadata` and commit the result."
)