From 723c5227a471aff3a1a5a3bc481984c99bf592aa Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 3 Mar 2021 09:02:49 -0500 Subject: 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. --- mesonbuild/modules/python.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules/python.py') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 2bd354fb7..1efebf880 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -473,7 +473,6 @@ class PythonModule(ExtensionModule): @FeatureNew('Python Module', '0.46.0') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.snippets.add('find_installation') # https://www.python.org/dev/peps/pep-0397/ def _get_win_pythonpath(self, name_or_path): @@ -502,7 +501,7 @@ class PythonModule(ExtensionModule): @FeatureNewKwargs('python.find_installation', '0.51.0', ['modules']) @disablerIfNotFound @permittedKwargs({'required', 'modules'}) - def find_installation(self, interpreter, state, args, kwargs): + def find_installation(self, state, args, kwargs): feature_check = FeatureNew('Passing "feature" option to find_installation', '0.48.0') disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, feature_check) want_modules = mesonlib.extract_as_list(kwargs, 'modules') # type: T.List[str] @@ -587,7 +586,7 @@ class PythonModule(ExtensionModule): mlog.debug(stderr) if isinstance(info, dict) and 'version' in info and self._check_version(name_or_path, info['version']): - res = PythonInstallation(interpreter, python, info) + res = PythonInstallation(self.interpreter, python, info) else: res = ExternalProgramHolder(NonExistingExternalProgram(), state.subproject) if required: -- cgit v1.2.3