summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-pandas/0001-BLD-add-option-to-specify-numpy-header-location.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-pandas/0001-BLD-add-option-to-specify-numpy-header-location.patch')
-rw-r--r--meta-python/recipes-devtools/python/python3-pandas/0001-BLD-add-option-to-specify-numpy-header-location.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pandas/0001-BLD-add-option-to-specify-numpy-header-location.patch b/meta-python/recipes-devtools/python/python3-pandas/0001-BLD-add-option-to-specify-numpy-header-location.patch
new file mode 100644
index 0000000000..e83576eb62
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pandas/0001-BLD-add-option-to-specify-numpy-header-location.patch
@@ -0,0 +1,61 @@
1From 16dd09e6c79768a24f5a50ec5985e0b6fdf17f35 Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Mon, 10 Mar 2025 13:52:11 +0100
4Subject: [PATCH] BLD: add option to specify numpy header location
5
6In some cases the numpy module might not be usable during build-time,
7especially when cross-compiling. (E.g. when compiling for arm32 on a
8x86-64 machine, the arm32 module is not usable at build time).
9
10This makes meson fail, as it isn't able to figure out the location of
11numpy headers.
12
13To allow an alternative way to find these headers, introduce a meson
14build option, where the location of the numpy headers can be specified.
15
16In case numpy module cannot be loaded for some reason to query the
17include folder location, fall back to the value of this meson option.
18
19Upstream-Status: Submitted [https://github.com/pandas-dev/pandas/pull/61095]
20
21Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
22---
23 meson.options | 1 +
24 pandas/meson.build | 13 ++++++++++---
25 2 files changed, 11 insertions(+), 3 deletions(-)
26 create mode 100644 meson.options
27
28--- /dev/null
29+++ b/meson.options
30@@ -0,0 +1 @@
31+option('numpy_inc_dir', type : 'string', description : 'The absolute path to the numpy headers')
32--- a/pandas/meson.build
33+++ b/pandas/meson.build
34@@ -3,17 +3,24 @@ incdir_numpy = run_command(py,
35 '-c',
36 '''
37 import os
38-import numpy as np
39+
40+try:
41+ import numpy as np
42+ base_incdir = np.get_include()
43+except Exception:
44+ base_incdir = os.getenv('NUMPY_INC_DIR')
45+
46 try:
47 # Check if include directory is inside the pandas dir
48 # e.g. a venv created inside the pandas dir
49 # If so, convert it to a relative path
50- incdir = os.path.relpath(np.get_include())
51+ incdir = os.path.relpath(base_incdir)
52 except Exception:
53- incdir = np.get_include()
54+ incdir = base_incdir
55 print(incdir)
56 '''
57 ],
58+ env: {'NUMPY_INC_DIR': get_option('numpy_inc_dir')},
59 check: true
60 ).stdout().strip()
61