From fe0d61001c35397c49dc71f9c877dbf7d8be5f23 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Fri, 5 May 2023 17:03:47 -0500 Subject: [PATCH] Tools: Add exclusion list to lupdate calls --- src/Tools/updatets.py | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py index ff41cf7494..5a1aaf8114 100755 --- a/src/Tools/updatets.py +++ b/src/Tools/updatets.py @@ -173,6 +173,16 @@ directories = [ }, ] +# Exclude these files from consideration +excluded_files = [ + ("Path", "UtilsArguments.py"), # Causes lupdate to hang + ("Path", "refactored_centroid_post.py"), # lupdate bug causes failure on line 245 + ("Path", "refactored_grbl_post.py"), # lupdate bug causes failure on line 212 + ("Path", "refactored_linuxcnc_post.py"), # lupdate bug causes failure on line 178 + ("Path", "refactored_mach3_mach4_post.py"), # lupdate bug causes failure on line 186 + ("Path", "refactored_test_post.py"), # lupdate bug causes failure on lines 42 and 179 +] + QMAKE = "" LUPDATE = "" PYLUPDATE = "" @@ -328,10 +338,18 @@ def update_translation(entry): "qrc", "py", ] - with open("files_to_translate.txt", "w") as file_list: + with open("files_to_translate.txt", "w", encoding="utf-8") as file_list: for root, dirs, files in os.walk("./"): for f in files: - if pathlib.Path(f).suffix[1:] in extensions: + skip = False + for exclusion in excluded_files: + if entry["tsname"] == exclusion[0] and f == exclusion[1]: + print( + f" (NOTE: Excluding file {f} because it is in the excluded_files list)" + ) + skip = True + break + if not skip and pathlib.Path(f).suffix[1:] in extensions: file_list.write(os.path.join(root, f) + "\n") try: @@ -350,14 +368,26 @@ def update_translation(entry): timeout=60, encoding="utf-8", ) + if not p: + raise RuntimeError("No return result from lupdate") + if not p.stdout: + raise RuntimeError("No stdout from lupdate") except Exception as e: + print("*" * 80) + print("*" * 80) + print("*" * 80) + print(f"ERROR RUNNING lupdate -- TRANSLATIONS FOR {entry['tsname']} PROBABLY FAILED...") print(str(e)) + print("*" * 80) + print("*" * 80) + print("*" * 80) os.chdir(cur) return with open(f"{cur}/tsupdate_stdout.log", "a", encoding="utf-8") as f: f.write(p.stdout) - print(p.stdout) + print(p.stdout, flush=True) + with open(f"{cur}/tsupdate_stderr.log", "a", encoding="utf-8") as f: f.write(p.stderr)