Skip to content

Commit 40501f0

Browse files
committed
rely on meson for numpy dependency
1 parent 35fff01 commit 40501f0

1 file changed

Lines changed: 1 addition & 29 deletions

File tree

discretize/_extensions/meson.build

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11
# NumPy include directory
22
numpy_nodepr_api = ['-DNPY_NO_DEPRECATED_API=NPY_1_22_API_VERSION']
3-
np_dep = dependency('numpy', required: false)
4-
if not np_dep.found()
5-
# For cross-compilation it is often not possible to run the Python interpreter
6-
# in order to retrieve numpy's include directory. It can be specified in the
7-
# cross file instead:
8-
# [properties]
9-
# numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include
10-
#
11-
# This uses the path as is, and avoids running the interpreter.
12-
incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given')
13-
if incdir_numpy == 'not-given'
14-
incdir_numpy = run_command(py,
15-
[
16-
'-c',
17-
'''import os
18-
import numpy as np
19-
try:
20-
incdir = os.path.relpath(np.get_include())
21-
except Exception:
22-
incdir = np.get_include()
23-
print(incdir)
24-
'''
25-
],
26-
check: true
27-
).stdout().strip()
28-
endif
29-
inc_np = include_directories(incdir_numpy)
30-
np_dep = declare_dependency(include_directories: inc_np)
31-
endif
3+
np_dep = dependency('numpy')
324

335
# Deal with M_PI & friends; add `use_math_defines` to c_args or cpp_args
346
# Cython doesn't always get this right itself (see, e.g., gh-16800), so

0 commit comments

Comments
 (0)