diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3-numpy')
3 files changed, 124 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..3e08b43587 --- /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,69 @@ | |||
1 | From b036c984b019d941ead2efd5a05d1588c4bc193a 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 | numpy/distutils/system_info.py | 42 +++++----------------------------- | ||
13 | 1 file changed, 6 insertions(+), 36 deletions(-) | ||
14 | |||
15 | diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py | ||
16 | index 6478548..c0620e7 100644 | ||
17 | --- a/numpy/distutils/system_info.py | ||
18 | +++ b/numpy/distutils/system_info.py | ||
19 | @@ -326,44 +326,14 @@ def add_system_root(library_root): | ||
20 | add_system_root(os.path.join(conda_dir, 'Library')) | ||
21 | |||
22 | else: | ||
23 | - default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib', | ||
24 | - '/opt/local/lib', '/sw/lib'], platform_bits) | ||
25 | default_runtime_dirs = [] | ||
26 | - default_include_dirs = ['/usr/local/include', | ||
27 | - '/opt/include', | ||
28 | - # path of umfpack under macports | ||
29 | - '/opt/local/include/ufsparse', | ||
30 | - '/opt/local/include', '/sw/include', | ||
31 | - '/usr/include/suitesparse'] | ||
32 | - default_src_dirs = ['.', '/usr/local/src', '/opt/src', '/sw/src'] | ||
33 | - | ||
34 | - default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib', | ||
35 | - '/usr/lib'], platform_bits) | ||
36 | - default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include'] | ||
37 | - | ||
38 | - if os.path.exists('/usr/lib/X11'): | ||
39 | - globbed_x11_dir = glob('/usr/lib/*/libX11.so') | ||
40 | - if globbed_x11_dir: | ||
41 | - x11_so_dir = os.path.split(globbed_x11_dir[0])[0] | ||
42 | - default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11']) | ||
43 | - default_x11_include_dirs.extend(['/usr/lib/X11/include', | ||
44 | - '/usr/include/X11']) | ||
45 | - | ||
46 | - with open(os.devnull, 'w') as tmp: | ||
47 | - try: | ||
48 | - p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE, | ||
49 | - stderr=tmp) | ||
50 | - except (OSError, DistutilsError): | ||
51 | - # OSError if gcc is not installed, or SandboxViolation (DistutilsError | ||
52 | - # subclass) if an old setuptools bug is triggered (see gh-3160). | ||
53 | - pass | ||
54 | - else: | ||
55 | - triplet = str(p.communicate()[0].decode().strip()) | ||
56 | - if p.returncode == 0: | ||
57 | - # gcc supports the "-print-multiarch" option | ||
58 | - default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)] | ||
59 | - default_lib_dirs += [os.path.join("/usr/lib/", triplet)] | ||
60 | |||
61 | + default_lib_dirs = libpaths(['/deadir/lib'], platform_bits) | ||
62 | + default_include_dirs = ['/deaddir/include'] | ||
63 | + default_src_dirs = ['.', '/deaddir/src'] | ||
64 | + | ||
65 | + default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits) | ||
66 | + default_x11_include_dirs = ['/deaddir/include'] | ||
67 | |||
68 | if os.path.join(sys.prefix, 'lib') not in default_lib_dirs: | ||
69 | default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib')) | ||
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..8b39b7bcfe --- /dev/null +++ b/meta/recipes-devtools/python/python3-numpy/fix_reproducibility.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From 45d76002bc989a9098141f2bfcd2d2fabc5a04d5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Fri, 29 Sep 2023 22:53:24 +0100 | ||
4 | Subject: [PATCH] This regex decides whether to use O3 opimisation on numpy or | ||
5 | not. | ||
6 | |||
7 | It includes "od", which happens to be a substring of "reproducible" | ||
8 | but not "qemux86-world". | ||
9 | |||
10 | The regex will run against all compiler options including things like: | ||
11 | |||
12 | -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 | ||
13 | |||
14 | i.e. including build paths. | ||
15 | |||
16 | Reduce the regex to something deterministic for our builds, assuming | ||
17 | nobody builds in /home/debug:full/ | ||
18 | |||
19 | The autobuilder race depended upon whether qemux86-world or the | ||
20 | reproducible target ran first and won the race to populate sstate. | ||
21 | |||
22 | Upstream-Status: Inappropriate [upstream have dropped distutils and switched to meson] | ||
23 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
24 | --- | ||
25 | numpy/distutils/ccompiler_opt.py | 2 +- | ||
26 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
27 | |||
28 | diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py | ||
29 | index b1a6fa3..7b0302b 100644 | ||
30 | --- a/numpy/distutils/ccompiler_opt.py | ||
31 | +++ b/numpy/distutils/ccompiler_opt.py | ||
32 | @@ -991,7 +991,7 @@ def __init__(self): | ||
33 | ("cc_is_nocc", "", ""), | ||
34 | ) | ||
35 | detect_args = ( | ||
36 | - ("cc_has_debug", ".*(O0|Od|ggdb|coverage|debug:full).*", ""), | ||
37 | + ("cc_has_debug", ".*debug:full.*", ""), | ||
38 | ("cc_has_native", | ||
39 | ".*(-march=native|-xHost|/QxHost|-mcpu=a64fx).*", ""), | ||
40 | # 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..6e76dffc59 --- /dev/null +++ b/meta/recipes-devtools/python/python3-numpy/run-ptest | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # By default, numpy will use /tmp as the root path for temporary files used | ||
4 | # during tests, but if this is a tmpfs it may fill up quickly and cause many of | ||
5 | # the tests to report "no space left on device" errors. Create a custom | ||
6 | # directory for these and point pytest at it so we can take advantage of the | ||
7 | # storage provided in the rootfs. | ||
8 | export PYTEST_DEBUG_TEMPROOT="/usr/lib/python3-numpy/ptest/tmp" | ||
9 | mkdir -p "$PYTEST_DEBUG_TEMPROOT" | ||
10 | |||
11 | # test_mem_policy fails if there's no C compiler present, but we don't want to | ||
12 | # include gcc as a ptest dependency, so skip that. test_big_arrays uses up a | ||
13 | # large amount of storage, so skip that too. | ||
14 | pytest --automake -m "not slow" -k "not test_mem_policy and not test_big_arrays" /usr/lib/python3.*/site-packages/numpy | ||
15 | rm -rf "$PYTEST_DEBUG_TEMPROOT" | ||