void-packages/srcpkgs/python3-pandas/patches/meson-numpy.patch

49 lines
1.6 KiB
Diff

--- ./pandas/meson.build.orig 2023-10-02 14:27:27.031989290 -0400
+++ ./pandas/meson.build 2023-10-02 14:30:18.017083106 -0400
@@ -1,7 +1,25 @@
-incdir_numpy = run_command(py,
- [
- '-c',
- '''
+# NumPy include directory - needed in all submodules
+# The chdir is needed because within numpy there's an `import signal`
+# statement, and we don't want that to pick up scipy's signal module rather
+# than the stdlib module. The try-except is needed because when things are
+# split across drives on Windows, there is no relative path and an exception
+# gets raised. There may be other such cases, so add a catch-all and switch to
+# an absolute path. Relative paths are needed when for example a virtualenv is
+# placed inside the source tree; Meson rejects absolute paths to places inside
+# the source tree.
+# For cross-compilation it is often not possible to run the Python interpreter
+# in order to retrieve numpy's include directory. It can be specified in the
+# cross file instead:
+# [properties]
+# numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include
+#
+# This uses the path as is, and avoids running the interpreter.
+incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given')
+if incdir_numpy == 'not-given'
+ incdir_numpy = run_command(py,
+ [
+ '-c',
+ '''
import os
import numpy as np
try:
@@ -12,10 +30,11 @@
except Exception:
incdir = np.get_include()
print(incdir)
- '''
- ],
- check: true
-).stdout().strip()
+ '''
+ ],
+ check: true
+ ).stdout().strip()
+endif
inc_np = include_directories(incdir_numpy)
inc_pd = include_directories('_libs/include')