diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-09-24 11:25:44 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-09-25 14:52:07 +0200 |
commit | 3a6920ebdcae0a2f9fee6ddf980fc8c7c94cf89c (patch) | |
tree | 899e07f3997425cf2402850380301aae03ce1f30 /mesonbuild/modules/i18n.py | |
parent | c4f96e00a6a49613efd25fe75b521ea2dff72f8d (diff) | |
download | meson-3a6920ebdcae0a2f9fee6ddf980fc8c7c94cf89c.zip meson-3a6920ebdcae0a2f9fee6ddf980fc8c7c94cf89c.tar.gz meson-3a6920ebdcae0a2f9fee6ddf980fc8c7c94cf89c.tar.bz2 |
Add helper to print warnings once
The helper is general, although in this patch it is only used for
warnings. No functional change intended.
Diffstat (limited to 'mesonbuild/modules/i18n.py')
-rw-r--r-- | mesonbuild/modules/i18n.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 1efc7b5..80ec8bd 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -16,7 +16,7 @@ import shutil from os import path from .. import coredata, mesonlib, build, mlog -from ..mesonlib import MesonException +from ..mesonlib import MesonException, run_once from . import ModuleReturnValue from . import ExtensionModule from ..interpreterbase import permittedKwargs, FeatureNew, FeatureNewKwargs @@ -58,13 +58,10 @@ PRESET_ARGS = { class I18nModule(ExtensionModule): - nogettext_warning_printed = False - - @classmethod - def nogettext_warning(cls): - if not cls.nogettext_warning_printed: - mlog.warning('Gettext not found, all translation targets will be ignored.') - cls.nogettext_warning_printed = True + @staticmethod + @run_once + def nogettext_warning(): + mlog.warning('Gettext not found, all translation targets will be ignored.') return ModuleReturnValue(None, []) @staticmethod |