From 675aa86ca6dc069e9a6b833ea9292a873e0cf0f5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Oct 2024 17:52:01 +1100 Subject: [PATCH] make license: clear trailing white space & ensure newline at eof Clear trailing space as this has as space at the line end has a special meaning in markdown. Write a new line at the end of the file since some development tools add this or note when it's missing, it's simplest just to add it. --- tools/utils_maintenance/make_license.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/utils_maintenance/make_license.py b/tools/utils_maintenance/make_license.py index fb2260ed591..c41e384ff26 100644 --- a/tools/utils_maintenance/make_license.py +++ b/tools/utils_maintenance/make_license.py @@ -207,6 +207,15 @@ class License: with open(self.filepath, 'r', encoding="utf8") as fh: license_raw = fh.read() + # Strip trailing space as this has a special meaning for mark-down, + # avoid editing the original texts as any edits may be overwritten + # when updating the licenses. + # + # This also removes page breaks "\x0C" or ^L. + # These could be replaced with sometime similar in markdown, + # unless this has some benefit, leave as-is. + license_raw = "\n".join(line.rstrip() for line in license_raw.split("\n")) + # Debug option commented out. # This is useful if you want a human-inspectionable document without the licenses. # license_raw = "# Debug" @@ -564,6 +573,8 @@ def generate_license_file(licenses: dict[str, License]) -> None: fh.write(exception_license.dump(i + 1)) + fh.write("\n") + print(f'\nLicense file successfully generated: "{filepath}"') print("Remember to commit the file to the Blender repository.\n")