From b9cce1a0babbb01e6a87250c0b273bff70bf2147 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Jan 2024 14:31:13 +0100 Subject: Brush up task file conversion scripts Modernize them by using f-strings and print out the issue count. Make flake2tasks.py include the error number in the warning text. Change-Id: I2d736c27dd3b2356e2b0d0d20f95112e7c37d3f9 Reviewed-by: Reviewed-by: David Schulz Reviewed-by: Shyamnath Premnadh Reviewed-by: Friedemann Kleint Reviewed-by: Cristian Maureira-Fredes --- scripts/flake2tasks.py | 9 ++++++--- scripts/shiboken2tasks.py | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/flake2tasks.py b/scripts/flake2tasks.py index f84ea8c71e1..6b6517a2ffc 100755 --- a/scripts/flake2tasks.py +++ b/scripts/flake2tasks.py @@ -14,7 +14,8 @@ import sys import re if __name__ == '__main__': - pattern = re.compile(r'^([^:]+):(\d+):\d+: E\d+ (.*)$') + pattern = re.compile(r'^([^:]+):(\d+):\d+: (.*)$') + n = 0 while True: line = sys.stdin.readline().rstrip() if not line: @@ -24,5 +25,7 @@ if __name__ == '__main__': file_name = match.group(1).replace('\\', '/') line_number = match.group(2) text = match.group(3) - output = "{}\t{}\twarn\t{}".format(file_name, line_number, text) - print(output) + print(f"{file_name}\t{line_number}\twarn\t{text}") + n += 1 + if n: + print(f"{n} issue(s) found.", file=sys.stderr) diff --git a/scripts/shiboken2tasks.py b/scripts/shiboken2tasks.py index d353c9c02f7..6598d0ac716 100755 --- a/scripts/shiboken2tasks.py +++ b/scripts/shiboken2tasks.py @@ -16,6 +16,7 @@ if __name__ == '__main__': # qt.shiboken: () ::[:] text # file might be c:\ on Windows pattern = re.compile(r'^qt\.shiboken: \(([^)]+)\) (..[^:]+):(\d+):(?:\d+:)? (.*)$') + n = 0 while True: line = sys.stdin.readline() if not line: @@ -26,6 +27,7 @@ if __name__ == '__main__': file_name = match.group(2).replace('\\', '/') line_number = match.group(3) text = match.group(4) - output = "{}\t{}\twarn\t{}: {}".format(file_name, line_number, - module, text) - print(output) + print(f"{file_name}\t{line_number}\twarn\t{module}: {text}") + n += 1 + if n: + print(f"{n} issue(s) found.", file=sys.stderr) -- cgit v1.2.3