diff --git a/Makefile b/Makefile index 1a9b5244f..abb89c555 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ maint: pip-compile -U requirements/dev.in pip-compile -U requirements/docs.in +changelog: + python make_changelog.py + upload: make clean python setup.py sdist bdist_wheel && twine upload -s dist/* diff --git a/make_changelog.py b/make_changelog.py index 5c97f0030..d248bf661 100644 --- a/make_changelog.py +++ b/make_changelog.py @@ -24,7 +24,7 @@ def main(changelog_path: str): today = datetime.now() header = f"Version {new_version}, {today:%Y-%m-%d}\n" header = header + "-" * (len(header) - 1) + "\n" - trailer = f"Full Changelog: https://github.com/py-pdf/PyPDF2/compare/{git_tag}...{new_version}" + trailer = f"\nFull Changelog: https://github.com/py-pdf/PyPDF2/compare/{git_tag}...{new_version}\n\n" new_entry = header + changes + trailer print(new_entry) @@ -107,7 +107,13 @@ def get_most_recent_git_tag(): def get_git_commits_since_tag(git_tag) -> List[Change]: commits = str( subprocess.check_output( - ["git", "--no-pager", "log", f"{git_tag}..HEAD", "--oneline"], + [ + "git", + "--no-pager", + "log", + f"{git_tag}..HEAD", + '--pretty=format:"%h%x09%s"', + ], stderr=subprocess.STDOUT, ) ).strip("'b\\n") @@ -115,7 +121,9 @@ def get_git_commits_since_tag(git_tag) -> List[Change]: def parse_commit_line(line) -> Change: - commit_hash, rest = line[: len("d5a5eea")], line[len("d5a5eea") :] + if "\\t" not in line: + raise ValueError(f"Invalid commit line: {line}") + commit_hash, rest = line.split("\\t", 1) if ":" in rest: prefix, message = rest.split(":", 1) else: