Merge pull request #5958 from keszybz/caching-cleanup

Caching cleanup
pull/5966/head
Jussi Pakkanen 5 years ago committed by GitHub
commit 0993c57ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      mesonbuild/mesonlib.py
  2. 42
      mesonbuild/modules/gnome.py
  3. 13
      mesonbuild/modules/i18n.py

@ -20,7 +20,7 @@ import time
import platform, subprocess, operator, os, shlex, shutil, re
import collections
from enum import Enum
from functools import lru_cache
from functools import lru_cache, update_wrapper
import typing
import uuid
@ -1496,6 +1496,19 @@ def get_wine_shortpath(winecmd, wine_paths):
return wine_path.strip(';')
def run_once(func):
ret = []
def wrapper(*args, **kwargs):
if ret:
return ret[0]
val = func(*args, **kwargs)
ret.append(val)
return val
return update_wrapper(wrapper, func)
class OptionProxy:
def __init__(self, value):

@ -18,6 +18,7 @@ functionality such as gobject-introspection, gresources and gtk-doc'''
import os
import copy
import subprocess
import functools
from .. import build
from .. import mlog
@ -41,31 +42,20 @@ from ..interpreterbase import noKwargs, permittedKwargs, FeatureNew, FeatureNewK
gresource_dep_needed_version = '>= 2.51.1'
native_glib_version = None
girwarning_printed = False
gdbuswarning_printed = False
gresource_warning_printed = False
_gir_has_option = {}
@functools.lru_cache(maxsize=None)
def gir_has_option(intr_obj, option):
global _gir_has_option
if option in _gir_has_option:
return _gir_has_option[option]
_gir_has_option[option] = False
try:
g_ir_scanner = intr_obj.find_program_impl('g-ir-scanner')
# Handle overriden g-ir-scanner
if isinstance(getattr(g_ir_scanner, "held_object", g_ir_scanner), interpreter.OverrideProgram):
assert option in ['--extra-library', '--sources-top-dirs']
_gir_has_option[option] = True
return True
opts = Popen_safe(g_ir_scanner.get_command() + ['--help'], stderr=subprocess.STDOUT)[1]
_gir_has_option[option] = option in opts
return option in opts
except (MesonException, FileNotFoundError, subprocess.CalledProcessError):
pass
return _gir_has_option[option]
return False
class GnomeModule(ExtensionModule):
gir_dep = None
@ -84,24 +74,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',

@ -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

Loading…
Cancel
Save