From e464835932feac9bc89de039fca4724b2192d057 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Nov 23 2023 05:15:40 +0000 Subject: use regex writting --- diff --git a/build_language_list.py b/build_language_list.py index efa7571..828c557 100755 --- a/build_language_list.py +++ b/build_language_list.py @@ -76,7 +76,7 @@ def scan_packages(package_folder: str, refresh: bool): if os.path.isfile(languages_file) is True: if refresh is False: - log.info("Language file already exist, no need to process") + log.debug("Language file already exist, no need to process") continue processed_files = dict() diff --git a/build_stats.py b/build_stats.py index 32ab76d..2082de0 100755 --- a/build_stats.py +++ b/build_stats.py @@ -274,7 +274,7 @@ def main(): def get_po_translation_level(file: str) -> dict: """ Call pocount to get translation stats for a file """ log = logging.getLogger("buildStats.get_po_translation_level") - command = ["sed", "-i", "/^#$/d;/^#[^\:\~,\.]/d", file] + command = ["sed", "-i", r"/^#$/d;/^#[^\:\~,\.]/d", file] subprocess.run(command, check=True, capture_output=True) try: diff --git a/build_tm.py b/build_tm.py index 1459d3c..f33ea44 100755 --- a/build_tm.py +++ b/build_tm.py @@ -55,10 +55,11 @@ def main(): log.info("Check if translation memories should be generated") with open("configuration.json", "r") as read_file: tm_for_versions = json.load(read_file)["tm_for_versions"] - if args.results not in tm_for_versions: - log.info(f"Configurations says to build tm only for {tm_for_versions}, nothing to do for {args.results}") - log.info("done") - return + + if args.results not in tm_for_versions: + log.info(f"Configurations says to build tm only for {tm_for_versions}, nothing to do for {args.results}") + log.info("done") + return log.info("Find detected languages") @@ -85,7 +86,7 @@ def main(): process_compendium(files, compendium_file, tm_folder, language_code) # remove non standard comments # taken from: https://github.com/translate/translate/blob/master/tools/pocommentclean - command = ["sed", "-i", "/^#$/d;/^#[^\:\~,\.]/d", compendium_file] + command = ["sed", "-i", r"/^#$/d;/^#[^\:\~,\.]/d", compendium_file] subprocess.run(command, check=True, capture_output=True) tmx_file = os.path.join(tm_folder, f"{language_code}.tmx")