diff options
| author | Ralf Gommers <ralf.gommers@gmail.com> | 2024-01-30 22:01:46 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2024-02-06 12:54:35 -0800 |
| commit | 80ed1dfa7ff6175b89038f98d935f803509cf86b (patch) | |
| tree | 3afac009621065cc7827e6fb991f82167dcd797d /mesonbuild/dependencies/python.py | |
| parent | 6fcf8632c6ca7c7d3812bf611ca99820264fae65 (diff) | |
| download | meson-80ed1dfa7ff6175b89038f98d935f803509cf86b.tar.gz | |
Add a numpy dependency with pkg-config and configtool methods
These are being added for NumPy 2.0 The implementation closely follows
the one for the pybind11 dependency.
Diffstat (limited to 'mesonbuild/dependencies/python.py')
| -rw-r--r-- | mesonbuild/dependencies/python.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index 342d94e72..6620eff20 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -61,6 +61,17 @@ class Pybind11ConfigToolDependency(ConfigToolDependency): self.compile_args = self.get_config_value(['--includes'], 'compile_args') +class NumPyConfigToolDependency(ConfigToolDependency): + + tools = ['numpy-config'] + + def __init__(self, name: str, environment: Environment, kwargs: T.Dict[str, T.Any]): + super().__init__(name, environment, kwargs) + if not self.is_found: + return + self.compile_args = self.get_config_value(['--cflags'], 'compile_args') + + class BasicPythonExternalProgram(ExternalProgram): def __init__(self, name: str, command: T.Optional[T.List[str]] = None, ext_prog: T.Optional[ExternalProgram] = None): @@ -412,3 +423,9 @@ packages['pybind11'] = pybind11_factory = DependencyFactory( [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.CMAKE], configtool_class=Pybind11ConfigToolDependency, ) + +packages['numpy'] = numpy_factory = DependencyFactory( + 'numpy', + [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL], + configtool_class=NumPyConfigToolDependency, +) |
