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.
This commit is contained in:
Campbell Barton
2024-10-19 17:52:01 +11:00
parent ba77368455
commit 675aa86ca6

View File

@@ -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")