From 7ffa9a3bd7119aef0fb5e773dd54a8a1734a0e79 Mon Sep 17 00:00:00 2001 From: Denis Kopyrin Date: Thu, 23 May 2024 01:48:24 +0800 Subject: [PATCH] Fixed fixlights.py compile error on python 3.12 (#798) * Fixed fixlights.py compile error on python 3.12 * Fixed assemble_sound.py compile error on python 3.12 --- tools/assemble_sound.py | 2 +- tools/fixlights.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/assemble_sound.py b/tools/assemble_sound.py index 54db6d88..64141e66 100755 --- a/tools/assemble_sound.py +++ b/tools/assemble_sound.py @@ -66,7 +66,7 @@ def validate(cond, msg, forstr=""): def strip_comments(string): - string = re.sub(re.compile("/\*.*?\*/", re.DOTALL), "", string) + string = re.sub(re.compile(r"/\*.*?\*/", re.DOTALL), "", string) return re.sub(re.compile("//.*?\n"), "", string) diff --git a/tools/fixlights.py b/tools/fixlights.py index c869b992..e504a882 100755 --- a/tools/fixlights.py +++ b/tools/fixlights.py @@ -88,7 +88,7 @@ for file in lightFiles: curLine = fileLines[index].strip() dl_index += 1 - match_result = re.search("Gfx\s*([A-Za-z_]\w+)\s*\[\s*\w*\s*\]\s*=\s*\{", curLine) + match_result = re.search(r"Gfx\s*([A-Za-z_]\w+)\s*\[\s*\w*\s*\]\s*=\s*\{", curLine) if match_result is not None and len(match_result.groups()) >= 1: curDL = match_result.group(1) dl_index = -1 @@ -136,7 +136,7 @@ def get_texscroll_files(): mat_grep_commands = [] for mat in material_deltas.keys(): print("grep -Rl \"segmented_to_virtual(" + re.escape(mat) + f"\" {sys.argv[1]}**/texscroll.inc.c") - mat_grep_commands.append("grep -Rl \"segmented_to_virtual(" + re.escape(mat) + f"\" {sys.argv[1]} --include \*texscroll*") + mat_grep_commands.append("grep -Rl \"segmented_to_virtual(" + re.escape(mat) + rf"\" {sys.argv[1]} --include \*texscroll*") texscroll_files = set() for cmd in mat_grep_commands: @@ -164,7 +164,7 @@ for file in t_files: curLine = curLineFull.strip() if not in_func: - match_result = re.search("void \w+\(\) \{", curLine) + match_result = re.search(r"void \w+\(\) \{", curLine) in_func = match_result is not None found_mat_match = False continue @@ -174,7 +174,7 @@ for file in t_files: continue if not found_mat_match: - match_result = re.search("Gfx \*mat = segmented_to_virtual\((\w*)\)", curLine) + match_result = re.search(r"Gfx \*mat = segmented_to_virtual\((\w*)\)", curLine) if not match_result: continue @@ -184,7 +184,7 @@ for file in t_files: mat_match = seg_mat continue - match_result = re.search("shift_\w*\(mat, (\d*),", curLine) + match_result = re.search(r"shift_\w*\(mat, (\d*),", curLine) if match_result is not None and len(match_result.groups()) >= 1: sts_index_str = match_result.group(1) sts_index = int(sts_index_str)