Add the extractTool to the Cura conanfile

CURA-9814
This commit is contained in:
Joey de l'Arago 2023-01-18 17:20:55 +01:00
parent 67301a5b54
commit 18bfcd60ba

View File

@ -27,7 +27,7 @@ class CuraConan(ConanFile):
# FIXME: Remove specific branch once merged to main # FIXME: Remove specific branch once merged to main
# Extending the conanfile with the UMBaseConanfile https://github.com/Ultimaker/conan-ultimaker-index/tree/CURA-9177_Fix_CI_CD/recipes/umbase # Extending the conanfile with the UMBaseConanfile https://github.com/Ultimaker/conan-ultimaker-index/tree/CURA-9177_Fix_CI_CD/recipes/umbase
python_requires = "umbase/[>=0.1.7]@ultimaker/stable" python_requires = "umbase/[>=0.1.7]@ultimaker/stable", "translationextractor/[>=1.0.0]@ultimaker/stable"
python_requires_extend = "umbase.UMBaseConanfile" python_requires_extend = "umbase.UMBaseConanfile"
options = { options = {
@ -327,6 +327,11 @@ class CuraConan(ConanFile):
if self.settings.os != "Windows" or self.conf.get("tools.microsoft.bash:path", check_type = str): if self.settings.os != "Windows" or self.conf.get("tools.microsoft.bash:path", check_type = str):
# FIXME: once m4, autoconf, automake are Conan V2 ready use self.win_bash and add gettext as base tool_requirement # FIXME: once m4, autoconf, automake are Conan V2 ready use self.win_bash and add gettext as base tool_requirement
cpp_info = self.dependencies["gettext"].cpp_info cpp_info = self.dependencies["gettext"].cpp_info
# Extract all the new strings and update the existing po files
extractTool = self.python_requires["translationextractor"].module.ExtractTranslations(self)
extractTool.extract(self.source_path, self.source_path.joinpath("resources", "i18n"), "cura.pot")
for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"): for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"):
pot_file = self.source_path.joinpath("resources", "i18n", po_file.with_suffix('.pot').name) pot_file = self.source_path.joinpath("resources", "i18n", po_file.with_suffix('.pot').name)
mkdir(self, str(unix_path(self, pot_file.parent))) mkdir(self, str(unix_path(self, pot_file.parent)))