aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-02-12 23:09:26 -0500
committerDylan Baker <dylan@pnwbakers.com>2023-02-22 10:32:09 -0800
commitee41de6d5bd24c289a73944279be60f752f45935 (patch)
tree00922140bb231c247bc5a86530f18879b91f6886 /mesonbuild
parent66b258b1efff4973bfb3f839f57888acc6e726c4 (diff)
downloadmeson-ee41de6d5bd24c289a73944279be60f752f45935.zip
meson-ee41de6d5bd24c289a73944279be60f752f45935.tar.gz
meson-ee41de6d5bd24c289a73944279be60f752f45935.tar.bz2
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.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/python.py6
1 files changed, 3 insertions, 3 deletions
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