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
0.62
Eli Schwartz 3 years ago committed by Nirbheek Chauhan
parent 99768b7bb6
commit 86d1f10a2f
  1. 2
      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'])

Loading…
Cancel
Save