diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-03-03 09:02:49 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-05-28 15:17:10 -0400 |
commit | 723c5227a471aff3a1a5a3bc481984c99bf592aa (patch) | |
tree | 647154c14f8a8de4f58da4b1bd272a5dfaf30efa /mesonbuild/modules/keyval.py | |
parent | 495e76d10a65df9e19e96e5470d64644da0e8099 (diff) | |
download | meson-723c5227a471aff3a1a5a3bc481984c99bf592aa.zip meson-723c5227a471aff3a1a5a3bc481984c99bf592aa.tar.gz meson-723c5227a471aff3a1a5a3bc481984c99bf592aa.tar.bz2 |
modules: Remove snippet methods
The only advantage they have is they have the interpreter in arguments,
but it's already available as self.interpreter. We should discourage
usage of the interpreter API and rely on ModuleState object instead in
the future.
This also lift the restriction that a module method cannot add build
targets, but that was not enforced for snippet methods anyway (and some
modules were doing it) and it's really loose restriction as it should
check for many other things if we wanted to make it consistent.
Diffstat (limited to 'mesonbuild/modules/keyval.py')
-rw-r--r-- | mesonbuild/modules/keyval.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mesonbuild/modules/keyval.py b/mesonbuild/modules/keyval.py index 5fc4d52..8e43491 100644 --- a/mesonbuild/modules/keyval.py +++ b/mesonbuild/modules/keyval.py @@ -25,7 +25,6 @@ class KeyvalModule(ExtensionModule): @FeatureNew('Keyval Module', '0.55.0') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.snippets.add('load') def _load_file(self, path_to_config): result = dict() @@ -47,7 +46,7 @@ class KeyvalModule(ExtensionModule): return result @noKwargs - def load(self, interpreter, state, args, kwargs): + def load(self, state, args, kwargs): sources = typeslistify(args, (str, mesonlib.File)) if len(sources) != 1: raise InvalidCode('load takes only one file input.') @@ -56,12 +55,12 @@ class KeyvalModule(ExtensionModule): is_built = False if isinstance(s, mesonlib.File): is_built = is_built or s.is_built - s = s.absolute_path(interpreter.environment.source_dir, interpreter.environment.build_dir) + s = s.absolute_path(self.interpreter.environment.source_dir, self.interpreter.environment.build_dir) else: - s = os.path.join(interpreter.environment.source_dir, s) + s = os.path.join(self.interpreter.environment.source_dir, s) - if s not in interpreter.build_def_files and not is_built: - interpreter.build_def_files.append(s) + if s not in self.interpreter.build_def_files and not is_built: + self.interpreter.build_def_files.append(s) return self._load_file(s) |