Merge pull request #9490 from chennes/addExclusionToUpdatets

Tools: Add exclusion list to lupdate calls
This commit is contained in:
Chris Hennes
2023-05-06 09:38:10 -05:00
committed by GitHub

View File

@@ -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)