From 3aad37b86e3aeab75f2881ef0916f842553afac6 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Thu, 30 Dec 2021 19:27:04 +0000 Subject: [PATCH] Replace list_translation_files() in setup.py --- setup.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index d583af14..9cdfbcea 100755 --- a/setup.py +++ b/setup.py @@ -93,11 +93,14 @@ class MyBuild(build): def run(self): if COMPILE_TRANSLATIONS: - for (src, bld_path) in list_translation_files(): - bld_path = Path(self.build_lib, bld_path) - pofile = polib.pofile(src) - bld_path.parent.mkdir(exist_ok=True, parents=True) - pofile.save_as_mofile(str(bld_path)) + for po in Path("po").glob("*.po"): + mo = Path( + self.build_lib, "linkcheck", "data", "locale", + po.stem, "LC_MESSAGES", AppName.lower() + ).with_suffix(".mo") + pofile = polib.pofile(str(po)) + mo.parent.mkdir(exist_ok=True, parents=True) + pofile.save_as_mofile(str(mo)) super().run() @@ -134,17 +137,6 @@ class MyInstallData(install_data): os.chmod(path, mode) -def list_translation_files(): - """Return list of translation files and their build paths.""" - for po in Path("po").glob("*.po"): - mo = Path( - "locale", po.stem, "LC_MESSAGES", AppName.lower() - ).with_suffix(".mo") - build_mo = Path("linkcheck", "data", mo) - build_mo.parent.mkdir(exist_ok=True, parents=True) - yield (str(po), build_mo) - - # scripts myname = "LinkChecker Authors" myemail = ""