diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-13 12:43:44 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-13 23:00:14 +0100 |
commit | da5f43b6cbecac437f80fbb1b1405292b3962d3b (patch) | |
tree | 6b1deae50857e1ab6ab93ed31da7d04f4980995c | |
parent | a75ab6b986ce570185e312b0d2a58f813525b728 (diff) |
create_changelog.py: Silence flake8 and Qt Creator's checker
Change-Id: If61585c69e9f73aecd8b001523165df0967721ed
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r-- | tools/create_changelog.py | 26 |
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))) |