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/gnome.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/gnome.py')
-rw-r--r-- | mesonbuild/modules/gnome.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 5c9d3dd..78a28fd 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -42,8 +42,6 @@ gresource_dep_needed_version = '>= 2.51.1' native_glib_version = None girwarning_printed = False -gdbuswarning_printed = False -gresource_warning_printed = False _gir_has_option = {} def gir_has_option(intr_obj, option): @@ -84,24 +82,20 @@ class GnomeModule(ExtensionModule): native_glib_version = '2.54' return native_glib_version + @mesonlib.run_once def __print_gresources_warning(self, state): - global gresource_warning_printed - if not gresource_warning_printed: - if not mesonlib.version_compare(self._get_native_glib_version(state), gresource_dep_needed_version): - mlog.warning('GLib compiled dependencies do not work reliably with \n' - 'the current version of GLib. See the following upstream issue:', - mlog.bold('https://bugzilla.gnome.org/show_bug.cgi?id=774368')) - gresource_warning_printed = True - return [] + if not mesonlib.version_compare(self._get_native_glib_version(state), + gresource_dep_needed_version): + mlog.warning('GLib compiled dependencies do not work reliably with \n' + 'the current version of GLib. See the following upstream issue:', + mlog.bold('https://bugzilla.gnome.org/show_bug.cgi?id=774368')) @staticmethod + @mesonlib.run_once def _print_gdbus_warning(): - global gdbuswarning_printed - if not gdbuswarning_printed: - mlog.warning('Code generated with gdbus_codegen() requires the root directory be added to\n' - ' include_directories of targets with GLib < 2.51.3:', - mlog.bold('https://github.com/mesonbuild/meson/issues/1387')) - gdbuswarning_printed = True + mlog.warning('Code generated with gdbus_codegen() requires the root directory be added to\n' + ' include_directories of targets with GLib < 2.51.3:', + mlog.bold('https://github.com/mesonbuild/meson/issues/1387')) @FeatureNewKwargs('gnome.compile_resources', '0.37.0', ['gresource_bundle', 'export', 'install_header']) @permittedKwargs({'source_dir', 'c_name', 'dependencies', 'export', 'gresource_bundle', 'install_header', |