diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3-numpy')
4 files changed, 158 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-numpy/0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch b/meta/recipes-devtools/python/python3-numpy/0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch new file mode 100644 index 0000000000..bbe309c556 --- /dev/null +++ b/meta/recipes-devtools/python/python3-numpy/0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch | |||
@@ -0,0 +1,70 @@ | |||
1 | From 46eea664cf89d0602e7ff16d587c37c045b125b7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Thu, 10 Dec 2015 13:20:30 +0200 | ||
4 | Subject: [PATCH] Don't search /usr and so on for libraries by default to | ||
5 | |||
6 | avoid host contamination. | ||
7 | |||
8 | Upstream-Status: Inappropriate (As the code stands, this is a hack) | ||
9 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | |||
12 | --- | ||
13 | numpy/distutils/system_info.py | 42 +++++----------------------------- | ||
14 | 1 file changed, 6 insertions(+), 36 deletions(-) | ||
15 | |||
16 | diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py | ||
17 | index feb28f6..a48d6d1 100644 | ||
18 | --- a/numpy/distutils/system_info.py | ||
19 | +++ b/numpy/distutils/system_info.py | ||
20 | @@ -327,44 +327,14 @@ def add_system_root(library_root): | ||
21 | add_system_root(os.path.join(conda_dir, 'Library')) | ||
22 | |||
23 | else: | ||
24 | - default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib', | ||
25 | - '/opt/local/lib', '/sw/lib'], platform_bits) | ||
26 | default_runtime_dirs = [] | ||
27 | - default_include_dirs = ['/usr/local/include', | ||
28 | - '/opt/include', | ||
29 | - # path of umfpack under macports | ||
30 | - '/opt/local/include/ufsparse', | ||
31 | - '/opt/local/include', '/sw/include', | ||
32 | - '/usr/include/suitesparse'] | ||
33 | - default_src_dirs = ['.', '/usr/local/src', '/opt/src', '/sw/src'] | ||
34 | - | ||
35 | - default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib', | ||
36 | - '/usr/lib'], platform_bits) | ||
37 | - default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include'] | ||
38 | - | ||
39 | - if os.path.exists('/usr/lib/X11'): | ||
40 | - globbed_x11_dir = glob('/usr/lib/*/libX11.so') | ||
41 | - if globbed_x11_dir: | ||
42 | - x11_so_dir = os.path.split(globbed_x11_dir[0])[0] | ||
43 | - default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11']) | ||
44 | - default_x11_include_dirs.extend(['/usr/lib/X11/include', | ||
45 | - '/usr/include/X11']) | ||
46 | - | ||
47 | - with open(os.devnull, 'w') as tmp: | ||
48 | - try: | ||
49 | - p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE, | ||
50 | - stderr=tmp) | ||
51 | - except (OSError, DistutilsError): | ||
52 | - # OSError if gcc is not installed, or SandboxViolation (DistutilsError | ||
53 | - # subclass) if an old setuptools bug is triggered (see gh-3160). | ||
54 | - pass | ||
55 | - else: | ||
56 | - triplet = str(p.communicate()[0].decode().strip()) | ||
57 | - if p.returncode == 0: | ||
58 | - # gcc supports the "-print-multiarch" option | ||
59 | - default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)] | ||
60 | - default_lib_dirs += [os.path.join("/usr/lib/", triplet)] | ||
61 | |||
62 | + default_lib_dirs = libpaths(['/deadir/lib'], platform_bits) | ||
63 | + default_include_dirs = ['/deaddir/include'] | ||
64 | + default_src_dirs = ['.', '/deaddir/src'] | ||
65 | + | ||
66 | + default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits) | ||
67 | + default_x11_include_dirs = ['/deaddir/include'] | ||
68 | |||
69 | if os.path.join(sys.prefix, 'lib') not in default_lib_dirs: | ||
70 | default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib')) | ||
diff --git a/meta/recipes-devtools/python/python3-numpy/0001-numpy-core-Define-RISCV-32-support.patch b/meta/recipes-devtools/python/python3-numpy/0001-numpy-core-Define-RISCV-32-support.patch new file mode 100644 index 0000000000..676bdbb3af --- /dev/null +++ b/meta/recipes-devtools/python/python3-numpy/0001-numpy-core-Define-RISCV-32-support.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From eb6d6579150bf4684603ce377c51e90ad3bb8109 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 15 Nov 2020 15:32:39 -0800 | ||
4 | Subject: [PATCH] numpy/core: Define RISCV-32 support | ||
5 | |||
6 | Helps compile on riscv32 | ||
7 | |||
8 | Upstream-Status: Submitted [https://github.com/numpy/numpy/pull/17780] | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | numpy/core/include/numpy/npy_cpu.h | 3 +++ | ||
12 | numpy/core/include/numpy/npy_endian.h | 1 + | ||
13 | 2 files changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h | ||
16 | index 78d229e..04be511 100644 | ||
17 | --- a/numpy/core/include/numpy/npy_cpu.h | ||
18 | +++ b/numpy/core/include/numpy/npy_cpu.h | ||
19 | @@ -19,6 +19,7 @@ | ||
20 | * NPY_CPU_ARCEB | ||
21 | * NPY_CPU_RISCV64 | ||
22 | * NPY_CPU_LOONGARCH | ||
23 | + * NPY_CPU_RISCV32 | ||
24 | * NPY_CPU_WASM | ||
25 | */ | ||
26 | #ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_CPU_H_ | ||
27 | @@ -104,6 +105,8 @@ | ||
28 | #define NPY_CPU_ARCEB | ||
29 | #elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 | ||
30 | #define NPY_CPU_RISCV64 | ||
31 | +#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32 | ||
32 | + #define NPY_CPU_RISCV32 | ||
33 | #elif defined(__loongarch__) | ||
34 | #define NPY_CPU_LOONGARCH | ||
35 | #elif defined(__EMSCRIPTEN__) | ||
36 | diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h | ||
37 | index 5e58a7f..0926212 100644 | ||
38 | --- a/numpy/core/include/numpy/npy_endian.h | ||
39 | +++ b/numpy/core/include/numpy/npy_endian.h | ||
40 | @@ -49,6 +49,7 @@ | ||
41 | || defined(NPY_CPU_PPC64LE) \ | ||
42 | || defined(NPY_CPU_ARCEL) \ | ||
43 | || defined(NPY_CPU_RISCV64) \ | ||
44 | + || defined(NPY_CPU_RISCV32) \ | ||
45 | || defined(NPY_CPU_LOONGARCH) \ | ||
46 | || defined(NPY_CPU_WASM) | ||
47 | #define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN | ||
48 | -- | ||
49 | 2.20.1 | ||
50 | |||
diff --git a/meta/recipes-devtools/python/python3-numpy/fix_reproducibility.patch b/meta/recipes-devtools/python/python3-numpy/fix_reproducibility.patch new file mode 100644 index 0000000000..d952aed00c --- /dev/null +++ b/meta/recipes-devtools/python/python3-numpy/fix_reproducibility.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | This regex decides whether to use O3 opimisation on numpy or not. | ||
2 | |||
3 | It includes "od", which happens to be a substring of "reproducible" | ||
4 | but not "qemux86-world". | ||
5 | |||
6 | The regex will run against all compiler options including things like: | ||
7 | |||
8 | -fmacro-prefix-map=/XXX/build/tmp/work/core2-64-poky-linux/python3-numpy/1.26.0/numpy-1.26.0=/usr/src/debug/python3-numpy/1.26.0-r0 | ||
9 | |||
10 | i.e. including build paths. | ||
11 | |||
12 | Reduce the regex to something deterministic for our builds, assuming | ||
13 | nobody builds in /home/debug:full/ | ||
14 | |||
15 | The autobuilder race depended upon whether qemux86-world or the | ||
16 | reproducible target ran first and won the race to populate sstate. | ||
17 | |||
18 | Upstream-Status: Inappropriate [upstream have dropped distutils and switched to meson] | ||
19 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
20 | |||
21 | Index: numpy-1.26.0/numpy/distutils/ccompiler_opt.py | ||
22 | =================================================================== | ||
23 | --- numpy-1.26.0.orig/numpy/distutils/ccompiler_opt.py | ||
24 | +++ numpy-1.26.0/numpy/distutils/ccompiler_opt.py | ||
25 | @@ -990,7 +990,7 @@ class _CCompiler: | ||
26 | ("cc_is_nocc", "", ""), | ||
27 | ) | ||
28 | detect_args = ( | ||
29 | - ("cc_has_debug", ".*(O0|Od|ggdb|coverage|debug:full).*", ""), | ||
30 | + ("cc_has_debug", ".*debug:full.*", ""), | ||
31 | ("cc_has_native", | ||
32 | ".*(-march=native|-xHost|/QxHost|-mcpu=a64fx).*", ""), | ||
33 | # in case if the class run with -DNPY_DISABLE_OPTIMIZATION | ||
diff --git a/meta/recipes-devtools/python/python3-numpy/run-ptest b/meta/recipes-devtools/python/python3-numpy/run-ptest new file mode 100644 index 0000000000..9a1c72aeb1 --- /dev/null +++ b/meta/recipes-devtools/python/python3-numpy/run-ptest | |||
@@ -0,0 +1,5 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | |||
3 | import numpy | ||
4 | numpy.test(label='full', verbose=2) | ||
5 | |||