summaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/mpi.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-10-24 15:35:37 -0700
committerDylan Baker <dylan@pnwbakers.com>2025-12-17 14:47:18 -0800
commit63f47811eaba44ccacb8b94ee0a224d5d75dc14b (patch)
treee08e29120c954d1591b8d9567a90bd6d98e27ebb /mesonbuild/dependencies/mpi.py
parentbd39b95ae78c20f02b5c58d0ef4448d41d6cc335 (diff)
downloadmeson-63f47811eaba44ccacb8b94ee0a224d5d75dc14b.tar.gz
Dependencies: Make use of the DependencyCandidate class
This makes the type checking more reasonable (including fixing an issue that newer mypy is pointing out to us), consolidating special cases, and improving code readability.
Diffstat (limited to 'mesonbuild/dependencies/mpi.py')
-rw-r--r--mesonbuild/dependencies/mpi.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/mesonbuild/dependencies/mpi.py b/mesonbuild/dependencies/mpi.py
index 78d793dbc..3f61d0730 100644
--- a/mesonbuild/dependencies/mpi.py
+++ b/mesonbuild/dependencies/mpi.py
@@ -3,14 +3,13 @@
from __future__ import annotations
-import functools
import typing as T
import os
import re
from ..envconfig import detect_cpu_family
from ..mesonlib import Popen_safe
-from .base import DependencyException, DependencyMethods, detect_compiler, SystemDependency
+from .base import DependencyCandidate, DependencyException, DependencyMethods, detect_compiler, SystemDependency
from .configtool import ConfigToolDependency
from .detect import packages
from .factory import factory_methods
@@ -75,14 +74,14 @@ def mpi_factory(env: 'Environment',
tool_names.extend(['mpifort', 'mpif90', 'mpif77'])
nwargs['tools'] = tool_names
- candidates.append(functools.partial(
- MPIConfigToolDependency, tool_names[0], env, nwargs))
+ candidates.append(DependencyCandidate.from_dependency(
+ tool_names[0], MPIConfigToolDependency, (env, nwargs)))
if DependencyMethods.SYSTEM in methods and env.machines[for_machine].is_windows():
- candidates.append(functools.partial(
- MSMPIDependency, 'msmpi', env, kwargs))
- candidates.append(functools.partial(
- IMPIDependency, 'impi', env, kwargs))
+ candidates.append(DependencyCandidate.from_dependency(
+ 'msmpi', MSMPIDependency, (env, kwargs)))
+ candidates.append(DependencyCandidate.from_dependency(
+ 'impi', IMPIDependency, (env, kwargs)))
# Only OpenMPI has pkg-config, and it doesn't work with the intel compilers
# for MPI, environment variables and commands like mpicc should have priority
@@ -94,8 +93,8 @@ def mpi_factory(env: 'Environment',
pkg_name = 'ompi-cxx'
elif language == 'fortran':
pkg_name = 'ompi-fort'
- candidates.append(functools.partial(
- PkgConfigDependency, pkg_name, env, kwargs))
+ candidates.append(DependencyCandidate.from_dependency(
+ pkg_name, PkgConfigDependency, (env, kwargs)))
return candidates