From 845bdef3869718bd7e4cfce374399f551398c9af Mon Sep 17 00:00:00 2001 From: Ariel Otilibili Date: Sat, 11 Jan 2025 16:56:38 +0100 Subject: [PATCH] util/lint: Clear syntax warnings in Python 3.12 Since Python 3.12, invalid escape sequences produce a SyntaxWarning; in the future, they will produce SyntaxError. Using raw strings clear out the warning. Below the command used for checking the fix worked. ``` $ python3 util/lint/checkpatch_json.py ``` Link: https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes Change-Id: I0177dc7f0d3013759879320afdb6ab548d356bc7 Signed-off-by: Ariel Otilibili Reviewed-on: https://review.coreboot.org/c/coreboot/+/85771 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- util/lint/checkpatch_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/lint/checkpatch_json.py b/util/lint/checkpatch_json.py index 967e898817..2960b8576e 100755 --- a/util/lint/checkpatch_json.py +++ b/util/lint/checkpatch_json.py @@ -39,7 +39,7 @@ def parse_file(input_file): file_path = temp[1].split(":")[0] line_number = temp[1].split(":")[1] update_struct( file_path.strip(), msg_output, str(line_number) ) - elif re.search("^\d+:\Z",line) != "None" and line.startswith("#"): + elif re.search(r"^\d+:\Z",line) != "None" and line.startswith("#"): file_path="/COMMIT_MSG" line = line.replace('#', '') line_number = int(line.split(":")[0]) + 2