aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/create_changelog.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/create_changelog.py b/tools/create_changelog.py
index 12c67d62f..d9ab24731 100644
--- a/tools/create_changelog.py
+++ b/tools/create_changelog.py
@@ -39,13 +39,11 @@
import re
import sys
-from textwrap import dedent
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
from subprocess import check_output, Popen, PIPE
from typing import Dict, List
-content = """
-Qt for Python @VERSION is a @TYPE release.
+content = """Qt for Python @VERSION is a @TYPE release.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
@@ -137,9 +135,12 @@ def check_tag(tag: str) -> bool:
def get_commit_content(sha: str) -> str:
- command= "git log {} -n 1 --pretty=format:%s%n%n%b".format(sha)
- print("{}: {}".format(get_commit_content.__name__, command), file=sys.stderr)
+ command = "git log {} -n 1 --pretty=format:%s%n%n%b".format(sha)
+ print("{}: {}".format(get_commit_content.__name__, command),
+ file=sys.stderr)
out, err = Popen(command, stdout=PIPE, shell=True).communicate()
+ if err:
+ print(err, file=sys.stderr)
return out.decode("utf-8")
@@ -150,6 +151,8 @@ def git_command(versions: List[str], pattern: str):
command += " | grep -o -E \"^[0-9a-f]{40}\""
print("{}: {}".format(git_command.__name__, command), file=sys.stderr)
out_sha1, err = Popen(command, stdout=PIPE, shell=True).communicate()
+ if err:
+ print(err, file=sys.stderr)
sha1_list = [s.decode("utf-8") for s in out_sha1.splitlines()]
for sha in sha1_list:
@@ -185,14 +188,15 @@ def gen_list(d: Dict[str, Dict[str, str]]) -> str:
if d:
return "".join(" - [{}] {}\n".format(v["task"], v["title"])
for _, v in d.items())
- else:
- return " - No changes"
+ return " - No changes"
+
def sort_dict(d: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str, str]]:
return dict(sorted(d.items(),
key=lambda kv: "{:5d}".format(
int(kv[1]['task'].replace("PYSIDE-", "")))))
+
if __name__ == "__main__":
args = parse_options()
@@ -213,7 +217,7 @@ if __name__ == "__main__":
# Generate message
print(content
- .replace("@VERSION", args.release)
- .replace("@TYPE", args.type)
- .replace("@PYSIDE", gen_list(pyside2_commits))
- .replace("@SHIBOKEN", gen_list(shiboken2_commits)))
+ .replace("@VERSION", args.release)
+ .replace("@TYPE", args.type)
+ .replace("@PYSIDE", gen_list(pyside2_commits))
+ .replace("@SHIBOKEN", gen_list(shiboken2_commits)))