From ee41de6d5bd24c289a73944279be60f752f45935 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 12 Feb 2023 23:09:26 -0500 Subject: python module: inline the dependency methods checking It can go directly inside the function which immediately uses it. There's no purpose in looking it up exactly once and using it exactly once, but looking it up outside the function and complicating the function signature in order to pass it as a function argument. --- mesonbuild/modules/python.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 58c1be5..fbc412f 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -282,10 +282,11 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): def python_factory(env: 'Environment', for_machine: 'MachineChoice', - kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods], + kwargs: T.Dict[str, T.Any], installation: 'PythonExternalProgram') -> T.List['DependencyGenerator']: # We can't use the factory_methods decorator here, as we need to pass the # extra installation argument + methods = process_method_kw({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM}, kwargs) embed = kwargs.get('embed', False) candidates: T.List['DependencyGenerator'] = [] pkg_version = installation.info['variables'].get('LDVERSION') or installation.info['version'] @@ -507,10 +508,9 @@ class PythonInstallation(ExternalProgramHolder): new_kwargs = kwargs.copy() new_kwargs['required'] = False - methods = process_method_kw({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM}, kwargs) # it's theoretically (though not practically) possible to not bind dep, let's ensure it is. dep: Dependency = NotFoundDependency('python', self.interpreter.environment) - for d in python_factory(self.interpreter.environment, for_machine, new_kwargs, methods, self.held_object): + for d in python_factory(self.interpreter.environment, for_machine, new_kwargs, self.held_object): dep = d() if dep.found(): break -- cgit v1.1