From de2c091ba6385af05b9556acd4daa06af9216ca3 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sat, 7 May 2022 23:06:22 -0400 Subject: [PATCH] i18n: fix bug where disabling gettext() broke merge_file() In the former case, the presence of tools is optional, but triggers a warning and then no-ops the target. In the latter case, the presence of the tools is mandatory. But if it was already looked up and discovered to be missing, we did not actually check that it is found before trying to use it. In the case that it isn't found, check again, so that we explicitly error out with a relevant error message due to setting the required flag. Fixes #10320 --- mesonbuild/modules/i18n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 4bbc69abf..151fd08a0 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -166,7 +166,7 @@ class I18nModule(ExtensionModule): KwargInfo('type', str, default='xml', validator=in_set_validator({'xml', 'desktop'})), ) def merge_file(self, state: 'ModuleState', args: T.List['TYPE_var'], kwargs: 'MergeFile') -> ModuleReturnValue: - if self.tools['msgfmt'] is None: + if self.tools['msgfmt'] is None or not self.tools['msgfmt'].found(): self.tools['msgfmt'] = state.find_program('msgfmt', for_machine=mesonlib.MachineChoice.BUILD) podir = path.join(state.build_to_src, state.subdir, kwargs['po_dir'])