Ensure exactly one trailing newline in rendered spec files

This commit is contained in:
Fabio Valentini 2022-07-24 00:35:51 +02:00
parent 53d07c28ad
commit 1763c73dfa
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
2 changed files with 4 additions and 2 deletions

View file

@ -584,7 +584,6 @@ def main():
else: else:
with open(spec_file, "w") as fobj: with open(spec_file, "w") as fobj:
fobj.write(spec_contents) fobj.write(spec_contents)
fobj.write("\n")
print(f'Wrote {fobj.name}') print(f'Wrote {fobj.name}')
for fname, diff in zip(patch_files, diffs): for fname, diff in zip(patch_files, diffs):
if fname: if fname:

View file

@ -109,6 +109,9 @@ def spec_file_render(
metadata=metadata, metadata=metadata,
patch_file_manual=patch_file_manual, patch_file_manual=patch_file_manual,
patch_file_automatic=patch_file_automatic, patch_file_automatic=patch_file_automatic,
**kwargs) + '\n' **kwargs)
if not spec_contents.endswith("\n"):
spec_contents += "\n"
return spec_contents return spec_contents