lint: convert checkpatch_json.py to python 3

Align all coreboot scripts on one python version.

Tested by running the original suggested test:
 $ nice -n 20 git diff HEAD~ | util/lint/checkpatch.pl \
     --no-signoff -q - | tee checkpatch.txt
 $ util/lint/checkpatch_json.py checkpatch.txt \
     comment.json checkpatch.txt

Change-Id: Iec2bb0be23b27a3eaf92f293c962a8e6bfb03af0
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42318
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by:  Felix Singer <felixsinger@posteo.net>
This commit is contained in:
Stefan Reinauer 2020-06-12 14:38:29 -07:00 committed by Patrick Georgi
parent 447472ec54
commit 57ead89356
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
""" """
@ -41,14 +41,14 @@ def parse_file(input_file):
def main(): def main():
if (len(sys.argv) < 3) or (sys.argv[1] == "-h"): if (len(sys.argv) < 3) or (sys.argv[1] == "-h"):
print "HELP:" print("HELP:")
print sys.argv[0] + " <input file> <output file in json>" print(sys.argv[0] + " <input file> <output file in json>")
sys.exit() sys.exit()
print sys.argv[1] print(sys.argv[1])
parse_file(sys.argv[1]) parse_file(sys.argv[1])
data['comments'] = list_temp data['comments'] = list_temp
print json.dumps(data) print(json.dumps(data))
out_file = open( sys.argv[2] , "w") out_file = open( sys.argv[2] , "w")
json.dump(data, out_file, sort_keys=True, indent=4) json.dump(data, out_file, sort_keys=True, indent=4)
out_file.close() out_file.close()