diff --git a/.tools/readmes/render.py b/.tools/readmes/render.py index bcd03a88591..d99270fbd58 100644 --- a/.tools/readmes/render.py +++ b/.tools/readmes/render.py @@ -333,7 +333,11 @@ def write(self): def read_current(self): try: with self.readme_filename.open("r", encoding="utf-8") as f: - return f.read() + current = f.read() + if current[-1] != "\n": + # Ensure there's always an ending newline + current += "\n" + return current except FileNotFoundError: return "" diff --git a/.tools/readmes/runner.py b/.tools/readmes/runner.py index 18a5315b7c9..b5691a9c316 100755 --- a/.tools/readmes/runner.py +++ b/.tools/readmes/runner.py @@ -173,12 +173,6 @@ def main(): def make_diff(renderer, id): current = renderer.read_current().split("\n") - if current[-1] != "": - # Ensure final "last" line - current += [""] expected = renderer.readme_text.split("\n") - if expected[-1] != "": - # Ensure final "last" line - expected += [""] diff = unified_diff(current, expected, f"{id}/current", f"{id}/expected") return "\n".join(diff)