From e24da8dd94dc135f6e34e34fc7e8d784fab8559f Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 17 Feb 2022 13:35:47 +0100 Subject: [PATCH] Tools: Allow to treat one single module with updatets script --- src/Tools/updatets.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py index f1b9c3e0dc..7dc23f39df 100755 --- a/src/Tools/updatets.py +++ b/src/Tools/updatets.py @@ -50,7 +50,7 @@ Version: 0.4 """ -import os, re +import os, re, sys directories = [ {"tsname":"FreeCAD", "workingdir":"./src/Gui", "tsdir":"Language"}, @@ -163,7 +163,7 @@ def update_translation(entry): execline.append (f"{LCONVERT} -i {tsBasename}py.ts {tsBasename}.ts -o {tsBasename}.ts {log_redirect}") execline.append (f"rm {tsBasename}py.ts") execline.append (f"rm dummy_cpp_file_for_lupdate.cpp") - print(f"Executing special commands in {entry['workingdir']}:") + print(f"Executing commands in {entry['workingdir']}:") for line in execline: print (line) os.system(line) @@ -177,7 +177,7 @@ def update_translation(entry): os.chdir(cur) -def main(): +def main(mod=None): find_tools() path = os.path.realpath(__file__) @@ -186,11 +186,21 @@ def main(): os.chdir("..") os.chdir("..") print("\n\n\n BEGINNING TRANSLATION EXTRACTION \n\n") - for i in directories: - update_translation(i) + if mod: + for i in directories: + if i["tsname"] == mod: + print("WARNING - Updating",mod,"ONLY") + update_translation(i) + break + else: + for i in directories: + update_translation(i) print("\nIf updatets.py was run successfully, the next step is to run ./src/Tools/updatecrowdin.py") print("stderr output from lupdate can be found in tsupdate_stderr.log") print("stdout output from lupdate can be found in tsupdate_stdout.log") if __name__ == "__main__": - main() + if len(sys.argv[1:]) > 0: + main(sys.argv[1]) + else: + main()