summaryrefslogtreecommitdiff
path: root/dev-python/numpy
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-05-31 17:23:40 -0500
committerroot <root@alpha.trunkmasters.com>2026-05-31 17:23:40 -0500
commitf953dc70343485250b836ad157649aaad47ac5bc (patch)
treee3634b454cf48f10ce9f8d12f10e60ad0a749239 /dev-python/numpy
parent5e07081cf4f5afaef79409b430a018b1daec073e (diff)
downloadbaldeagleos-repo-f953dc70343485250b836ad157649aaad47ac5bc.tar.gz
baldeagleos-repo-f953dc70343485250b836ad157649aaad47ac5bc.tar.xz
baldeagleos-repo-f953dc70343485250b836ad157649aaad47ac5bc.zip
Adding metadata
Diffstat (limited to 'dev-python/numpy')
-rw-r--r--dev-python/numpy/Manifest7
-rw-r--r--dev-python/numpy/files/numpy-2.3.2-arm-asimddp.patch30
-rw-r--r--dev-python/numpy/files/numpy-2.3.2-no-detect.patch72
-rw-r--r--dev-python/numpy/metadata.xml2
-rw-r--r--dev-python/numpy/numpy-2.2.6.ebuild2
-rw-r--r--dev-python/numpy/numpy-2.4.4.ebuild2
-rw-r--r--dev-python/numpy/numpy-2.4.5.ebuild (renamed from dev-python/numpy/numpy-2.3.5.ebuild)135
-rw-r--r--dev-python/numpy/numpy-2.4.6.ebuild (renamed from dev-python/numpy/numpy-2.3.2.ebuild)158
8 files changed, 208 insertions, 200 deletions
diff --git a/dev-python/numpy/Manifest b/dev-python/numpy/Manifest
index 90b45ef87f57..73a1eec1f58f 100644
--- a/dev-python/numpy/Manifest
+++ b/dev-python/numpy/Manifest
@@ -1,6 +1,7 @@
DIST numpy-2.2.6.tar.gz 20276440 BLAKE2B 597ebbc72b2b3901bba4e0946f4f63ff13baf3b04d2f44d6e1ce8d05112f5d7191cb2e2f80e20006f0bc57a5a3f395fcc6003d9593e41b057394c12ad44f69f7 SHA512 00c82476c6cc8e68c4cd3210896172d91bdb52a46676931d173a3bbd772b29cebc8e819dfbbaf621eba9225fff3fa3f81426fe864d8812de4ff2975e7ac5c338
-DIST numpy-2.3.2.tar.gz 20489306 BLAKE2B 66a683a62daf3971c01a484d6e8c56e592744b93ec2648b61246d9969b02c62256153fb7c643002d7f82ebf1bfd5c9f34c14449b9daf85007e6cb854e97852dd SHA512 8f315a681704f1a18712828b5b9d5cd602576230fb08ff00c293ce129656faa49c9e01a446989dbd4d678166975432b531915e4838be66655ead1f0fc05be861
-DIST numpy-2.3.5.tar.gz 20584950 BLAKE2B a203d249631a49c8a28d8b81fb395d41f40c02c32955014c9010fd887bbd29631a94bf0f781a16a3b84fdde740c7728a5bfdcf4489e2c82b17c7f9cf2f641230 SHA512 055e5c0363e1e6d75e514b2f3a2dbbf830a0172a1381f3872b68cc4605bfafae91afcab37b710d12379488eba343fad7aeeb466ea23fa45d1d817a33aefe75fe
-DIST numpy-2.3.5.tar.gz.provenance 9651 BLAKE2B 51039d094df01b45dfc013deb5149d6788869b5d36f187acd3048e9c5c7fca06c2d90e074633cd4a434d83112898a64a04e1b031760cbf5ad11f824f9384e588 SHA512 a86367d78e782148c3278fbc45b996a31d73ea5750bfee4599b6b06797ec196b9c8d25773efd7896e128900be9cf325d3ba8d0edae3701d1907626ee3d92e54c
DIST numpy-2.4.4.tar.gz 20731587 BLAKE2B 0cfa06b9a471e1a54a222f98f660b49e893fef65416d1da724c66811281e658cf0a5df4ad5e82296c2dbd9eee7ce97bbf5780bcd21022c7af515f5afe1763504 SHA512 7abec48faf957449248194683aaf2d97c2424ab9ab22cfa6e6676e79185da4ad971839f24b73c8576e582f91e7d941a8fc2b1550ee84b26d8ee6273d1009deee
DIST numpy-2.4.4.tar.gz.provenance 9927 BLAKE2B 878acd595cb1bdce337bb1c9058583494df25b8f5d3f515c8f1d64b2b58446390b6b52b5fdd91a42a50d8fd49f420e2ed9e47bfc56c2c213391482e663015e26 SHA512 b20a603fa02973315eb2a40db2573b8b346e0729c3e4a1a8dd1e7bc0f0bb1be3b5b3a5a10372fda8a423ea0988cfe4a292f5c4ea8a1401f4bba288d650bbe2f8
+DIST numpy-2.4.5.tar.gz 20735669 BLAKE2B 93a3484f39974893c34cc51f6073e3f1c1a4bf4488acc133f84d668819744090d2e355b4d6a20159e985b3b3ebe4beb15746c881f1f252f31e3ab5ccd5865651 SHA512 f490da5549070afe74d729aef5dd9af5dfd2f0e40f40ae077aa67716ed6131116e82ef38a8153d78e6aff951bca3f0f519e02d53b796a8a20e886364c4156a58
+DIST numpy-2.4.5.tar.gz.provenance 9739 BLAKE2B 273d39dedf54f896f82e2cc6f1631282a0a0ac79c9c281d0935714879e949f3cb628f3b506a56e87a182cfff51c15c9c76dc4a20c1841278ff118260fe04d87f SHA512 52e0f67b2b8b379169a5486ec179026234d01fa96bcb604be6736f131d0423247be5a3b7be5aac9c7b2ea7df60e26c02cfe6949e211f150cc41d5017776e6328
+DIST numpy-2.4.6.tar.gz 20735807 BLAKE2B 8866cd9117365797a377278f0002930f0cae264bddbc9d0d7943907b6d54c80d7b0c7cc81263bfed0310e60754693c66d461ed7230ce457c30d9b6d3e50b27e7 SHA512 6e78c61a54bb89e202b0365440cef8f5dc948ac94eb39dfcd5af56a1ddce96ba8c7b4cd9b9c474be5f7642e7ec56cdc8eb238eb1871238911b94f9a90e2720ca
+DIST numpy-2.4.6.tar.gz.provenance 9880 BLAKE2B ecfe5e7b5d53ac975d3ff69b3ea463be4495f7759b63a92a455be8c29b66931707c4ca8dc0fa8296ced2182246738c935814932d31649a624fbfb06ceaafb76c SHA512 724b0cc27b8120b62ef1aae8c8ed673cd2bf4c430ddddf56ff1550f9d80ecfbc499f3df4c0a3370fecf19691eb3057e48057bd10d4d25a875a1f2f6a512e5c2f
diff --git a/dev-python/numpy/files/numpy-2.3.2-arm-asimddp.patch b/dev-python/numpy/files/numpy-2.3.2-arm-asimddp.patch
deleted file mode 100644
index ac4c77d1a25b..000000000000
--- a/dev-python/numpy/files/numpy-2.3.2-arm-asimddp.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 111fe76ebf9e3dc528a2d808626808bd9601938d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Mon, 18 Aug 2025 20:55:31 +0200
-Subject: [PATCH] BLD: wire up `ASIMDDP` feature to `ARM_FEATURES`
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add the `ASIMDDP` feature to the `ARM_FEATURES` dictionary, to fix
-an error when it is explicitly listed in `cpu-baseline`.
-
-Fixes #29570
-
-Signed-off-by: Michał Górny <mgorny@gentoo.org>
----
- meson_cpu/arm/meson.build | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/meson_cpu/arm/meson.build b/meson_cpu/arm/meson.build
-index 7ffa3ef58ed0..5478e52cdcea 100644
---- a/meson_cpu/arm/meson.build
-+++ b/meson_cpu/arm/meson.build
-@@ -60,6 +60,6 @@ SVE = mod_features.new(
- # TODO: Add support for MSVC
- ARM_FEATURES = {
- 'NEON': NEON, 'NEON_FP16': NEON_FP16, 'NEON_VFPV4': NEON_VFPV4,
-- 'ASIMD': ASIMD, 'ASIMDHP': ASIMDHP, 'ASIMDFHM': ASIMDFHM,
-+ 'ASIMD': ASIMD, 'ASIMDHP': ASIMDHP, 'ASIMDDP': ASIMDDP, 'ASIMDFHM': ASIMDFHM,
- 'SVE': SVE
- }
diff --git a/dev-python/numpy/files/numpy-2.3.2-no-detect.patch b/dev-python/numpy/files/numpy-2.3.2-no-detect.patch
deleted file mode 100644
index 91ed2aa8f1e5..000000000000
--- a/dev-python/numpy/files/numpy-2.3.2-no-detect.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5591f1109b45a482bdaea3d3e44a80212a188edd Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@quansight.com>
-Date: Mon, 28 Jul 2025 21:33:18 +0200
-Subject: [PATCH 1/2] BLD: provide explicit control over cpu-baseline detection
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add a new `cpu-baseline-detect` feature flag that can be used to more
-precisely control the use of CPU baseline detection. This can be used
-by packages to more precisely control used SIMD code independently
-of compiler flags specified. The option follows typical feature
-semantics -- with `auto` preserving the current behavior of enabling
-when relevant compiler flags are found, `enabled` forcing it on
-based on the implicit compiler defaults, and `disabled` forcing it off.
-
-Signed-off-by: Michał Górny <mgorny@quansight.com>
----
- meson.options | 2 ++
- meson_cpu/meson.build | 22 ++++++++++++----------
- 2 files changed, 14 insertions(+), 10 deletions(-)
-
-diff --git a/meson.options b/meson.options
-index b09992fe9b91..f17f9901664a 100644
---- a/meson.options
-+++ b/meson.options
-@@ -28,6 +28,8 @@ option('disable-optimization', type: 'boolean', value: false,
- description: 'Disable CPU optimized code (dispatch,simd,unroll...)')
- option('cpu-baseline', type: 'string', value: 'min',
- description: 'Minimal set of required CPU features')
-+option('cpu-baseline-detect', type: 'feature', value: 'auto',
-+ description: 'Detect CPU baseline from the compiler flags')
- option('cpu-dispatch', type: 'string', value: 'max -xop -fma4',
- description: 'Dispatched set of additional CPU features')
- option('test-simd', type: 'array',
-diff --git a/meson_cpu/meson.build b/meson_cpu/meson.build
-index e5b6d0fbe7be..1c4c6eecb308 100644
---- a/meson_cpu/meson.build
-+++ b/meson_cpu/meson.build
-@@ -46,20 +46,22 @@ if get_option('disable-optimization')
- CPU_CONF_BASELINE = 'none'
- CPU_CONF_DISPATCH = 'none'
- else
-- baseline_detect = false
-+ baseline_detect = get_option('cpu-baseline-detect').enabled()
- c_args = get_option('c_args')
-- foreach arg : c_args
-- foreach carch : ['-march', '-mcpu', '-xhost', '/QxHost']
-- if arg.contains(carch)
-- message('Appending option "detect" to "cpu-baseline" due to detecting global architecture c_arg "' + arg + '"')
-- baseline_detect = true
-+ if get_option('cpu-baseline-detect').auto()
-+ foreach arg : c_args
-+ foreach carch : ['-march', '-mcpu', '-xhost', '/QxHost']
-+ if arg.contains(carch)
-+ message('Appending option "detect" to "cpu-baseline" due to detecting global architecture c_arg "' + arg + '"')
-+ baseline_detect = true
-+ break
-+ endif
-+ endforeach
-+ if baseline_detect
- break
- endif
- endforeach
-- if baseline_detect
-- break
-- endif
-- endforeach
-+ endif
- # The required minimal set of required CPU features.
- CPU_CONF_BASELINE = get_option('cpu-baseline')
- if baseline_detect
diff --git a/dev-python/numpy/metadata.xml b/dev-python/numpy/metadata.xml
index 0ea58d4e43ad..0d3f73a0880f 100644
--- a/dev-python/numpy/metadata.xml
+++ b/dev-python/numpy/metadata.xml
@@ -28,5 +28,5 @@
compatibility with the baseline set by CPU_FLAGS_*.
</flag>
</use>
- <origin>gentoo-staging</origin>
+ <origin>liguros-repo</origin>
</pkgmetadata> \ No newline at end of file
diff --git a/dev-python/numpy/numpy-2.2.6.ebuild b/dev-python/numpy/numpy-2.2.6.ebuild
index 0feb7a6ffaf9..8675ab6f61f4 100644
--- a/dev-python/numpy/numpy-2.2.6.ebuild
+++ b/dev-python/numpy/numpy-2.2.6.ebuild
@@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=meson-python
-PYTHON_COMPAT=( python3_{10..14} )
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
PYTHON_REQ_USE="threads(+)"
FORTRAN_NEEDED=lapack
diff --git a/dev-python/numpy/numpy-2.4.4.ebuild b/dev-python/numpy/numpy-2.4.4.ebuild
index c14f69aeda45..b0d2b9ad0c0f 100644
--- a/dev-python/numpy/numpy-2.4.4.ebuild
+++ b/dev-python/numpy/numpy-2.4.4.ebuild
@@ -6,7 +6,7 @@ EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=meson-python
PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
-PYTHON_COMPAT=( python3_{10..14} )
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
PYTHON_REQ_USE="threads(+)"
FORTRAN_NEEDED=lapack
diff --git a/dev-python/numpy/numpy-2.3.5.ebuild b/dev-python/numpy/numpy-2.4.5.ebuild
index 93554b1e3335..0457d5672a75 100644
--- a/dev-python/numpy/numpy-2.3.5.ebuild
+++ b/dev-python/numpy/numpy-2.4.5.ebuild
@@ -6,7 +6,7 @@ EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=meson-python
PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
-PYTHON_COMPAT=( python3_{10..14} )
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
PYTHON_REQ_USE="threads(+)"
FORTRAN_NEEDED=lapack
@@ -19,9 +19,11 @@ HOMEPAGE="
https://pypi.org/project/numpy/
"
-LICENSE="BSD"
+LICENSE="BSD 0BSD MIT ZLIB CC0-1.0"
SLOT="0/2"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
# +lapack because the internal fallbacks are pretty slow. Building without blas
# is barely supported anyway, see bug #914358.
IUSE="big-endian +cpudetection index64 +lapack"
@@ -30,9 +32,7 @@ IUSE="big-endian +cpudetection index64 +lapack"
ARM_FLAGS=( neon{,-fp16} vfpv4 asimd{,hp,dp,fhm} sve )
PPC_FLAGS=( vsx vsx2 vsx3 vsx4 )
X86_FLAGS=(
- sse{,2,3,4_1,4_2} ssse3 popcnt avx{,2} xop fma{3,4}
- f16c avx512{f,cd,pf,er,dq,bw,vl,ifma,vbmi}
- avx512_{vpopcntdq,4vnniw,4fmaps,vbmi2,bitalg,fp16,vnni}
+ avx2 avx512{bw,dq,vl} avx512_{bf16,bitalg,fp16,vbmi2} sse4_2
)
IUSE+="
${ARM_FLAGS[*]/#/cpu_flags_arm_}
@@ -71,13 +71,6 @@ EPYTEST_PLUGINS=( hypothesis pytest-timeout )
EPYTEST_XDIST=1
distutils_enable_tests pytest
-PATCHES=(
- # https://github.com/numpy/numpy/pull/29459
- "${FILESDIR}"/${PN}-2.3.2-no-detect.patch
- # https://github.com/numpy/numpy/pull/29579
- "${FILESDIR}"/${PN}-2.3.2-arm-asimddp.patch
-)
-
has_all_x86() {
local flag
for flag; do
@@ -138,75 +131,33 @@ python_configure_all() {
done
;;
amd64|x86)
- # every flag implies the previous one
- for flag in sse{,2,3} ssse3 sse4_1 popcnt sse4_2 avx; do
- if ! use "cpu_flags_x86_${flag}"; then
- break
- fi
- flag=${flag/_}
- cpu_baseline+=( "${flag^^}" )
- done
-
- # these imply AVX
- if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == AVX ]]; then
- for flag in xop fma4 f16c; do
- if use "cpu_flags_x86_${flag}"; then
- cpu_baseline+=( "${flag^^}" )
- fi
- done
- fi
-
- # another chain started on implying F16C
- if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == F16C ]]; then
- for flag in fma3 avx2 avx512f avx512cd; do
- if ! use "cpu_flags_x86_${flag}"; then
- break
- fi
- cpu_baseline+=( "${flag^^}" )
- done
- fi
+ # upstream combines multiple instructions into sets
+ local mapping=(
+ # for these, we just check the newest instruction set,
+ # since all earlier instruction sets imply it
+ "X86_V2=sse4_2"
+ "X86_V3=avx2"
+ # from here on, we check all features that were added
+ # in the lowest CPU supporting them all
+ # https://en.wikipedia.org/wiki/AVX-512
+ "X86_V4=avx512bw avx512dq avx512vl"
+ "AVX512_ICL=avx512_vbmi2 avx512_bitalg"
+ "AVX512_SPR=avx512_bf16 avx512_fp16"
+ )
- if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == AVX512CD ]]; then
- # upstream combines multiple instructions into per-CPU sets
- local -A avx512_mapping=(
- [AVX512_KNL]="avx512pf avx512er"
- [AVX512_KNM]="avx512_vpopcntdq avx512_4vnniw avx512_4fmaps"
- [AVX512_SKX]="avx512dq avx512bw avx512vl"
- [AVX512_CLX]="avx512_vnni"
- [AVX512_CNL]="avx512ifma avx512vbmi"
- [AVX512_ICL]="avx512_vbmi2 avx512_bitalg"
- [AVX512_SPR]="avx512_fp16"
- )
+ local m
+ for m in "${mapping[@]}"; do
+ local feature=${m%=*}
+ local sets=${m#*=}
- # 1. AVX512CD -> AVX512_KNL -> AVX512_KNM
- if has_all_x86 ${avx512_mapping[AVX512_KNL]}; then
- cpu_baseline+=( AVX512_KNL )
- if has_all_x86 ${avx512_mapping[AVX512_KNM]}; then
- cpu_baseline+=( AVX512_KNM )
- fi
- fi
- # 2. AVX512CD -> AVX512_SKX -> [AVX512_CLX, AVX512_CNL]
- if has_all_x86 ${avx512_mapping[AVX512_SKX]}; then
- cpu_baseline+=( AVX512_SKX )
- if has_all_x86 ${avx512_mapping[AVX512_CLX]}; then
- cpu_baseline+=( AVX512_CLX )
- fi
- if has_all_x86 ${avx512_mapping[AVX512_CNL]}; then
- cpu_baseline+=( AVX512_CNL )
- fi
- fi
- # 3. [AVX512_CLX, AVX512_CNL] -> AVX512_ICL -> AVX512_SPR
- if [[ ${cpu_baseline[-1]} == AVX512_CNL &&
- ${cpu_baseline[-2]} == AVX512_CLX ]]
- then
- if has_all_x86 ${avx512_mapping[AVX512_ICL]}; then
- cpu_baseline+=( AVX512_ICL )
- if has_all_x86 ${avx512_mapping[AVX512_SPR]}; then
- cpu_baseline+=( AVX512_SPR )
- fi
- fi
+ if has_all_x86 ${sets}; then
+ einfo "${feature} enabled: all of ${sets} enabled"
+ cpu_baseline+=( "${feature}" )
+ else
+ einfo "${feature} disabled: not all of ${sets} enabled"
+ break
fi
- fi
+ done
;;
*)
cpu_baseline=MIN
@@ -220,8 +171,7 @@ python_configure_all() {
-Dlapack=$(usev lapack $(usex index64 lapack64 lapack))
-Dcpu-baseline="${cpu_baseline[*]}"
-Dcpu-baseline-detect=disabled
- # '-XOP -FMA4' is upstream default, since these are deprecated
- -Dcpu-dispatch="$(usev cpudetection 'MAX -XOP -FMA4')"
+ -Dcpu-dispatch="$(usev cpudetection MAX)"
)
# bug #922457
@@ -253,8 +203,15 @@ python_test() {
# Flaky, reruns don't help
numpy/f2py/tests/test_crackfortran.py
- numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
numpy/f2py/tests/test_data.py::TestData{,F77}::test_crackedlines
+ numpy/f2py/tests/test_f2py2e.py::test_gen_pyf
+ numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
+
+ # Broken by new setuptools
+ numpy/distutils/tests/test_fcompiler.py
+ numpy/distutils/tests/test_fcompiler_gnu.py
+ numpy/distutils/tests/test_fcompiler_intel.py
+ numpy/distutils/tests/test_fcompiler_nagfor.py
)
if [[ $(uname -m) == armv8l ]]; then
@@ -348,6 +305,20 @@ python_test() {
)
fi
+ case ${EPYTHON} in
+ pypy3.11)
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_regression.py::TestRegression::test_buffer_hashlib
+ numpy/random/tests/test_generator_mt19937.py::TestIntegers::test_repeatability
+ numpy/random/tests/test_generator_mt19937.py::TestRandomDist::test_choice_large_sample
+ numpy/random/tests/test_generator_mt19937.py::test_jumped
+ numpy/random/tests/test_random.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::test_integer_repeat
+ )
+ ;;
+ esac
+
cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
epytest
}
diff --git a/dev-python/numpy/numpy-2.3.2.ebuild b/dev-python/numpy/numpy-2.4.6.ebuild
index 52ee1fe376ca..0457d5672a75 100644
--- a/dev-python/numpy/numpy-2.3.2.ebuild
+++ b/dev-python/numpy/numpy-2.4.6.ebuild
@@ -5,7 +5,8 @@ EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=meson-python
-PYTHON_COMPAT=( python3_{10..14} )
+PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
PYTHON_REQ_USE="threads(+)"
FORTRAN_NEEDED=lapack
@@ -18,17 +19,31 @@ HOMEPAGE="
https://pypi.org/project/numpy/
"
-LICENSE="BSD"
+LICENSE="BSD 0BSD MIT ZLIB CC0-1.0"
SLOT="0/2"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86"
+if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
# +lapack because the internal fallbacks are pretty slow. Building without blas
# is barely supported anyway, see bug #914358.
-IUSE="big-endian +lapack"
+IUSE="big-endian +cpudetection index64 +lapack"
+
+# upstream-flag[:gentoo-flag]
+ARM_FLAGS=( neon{,-fp16} vfpv4 asimd{,hp,dp,fhm} sve )
+PPC_FLAGS=( vsx vsx2 vsx3 vsx4 )
+X86_FLAGS=(
+ avx2 avx512{bw,dq,vl} avx512_{bf16,bitalg,fp16,vbmi2} sse4_2
+)
+IUSE+="
+ ${ARM_FLAGS[*]/#/cpu_flags_arm_}
+ ${PPC_FLAGS[*]/#/cpu_flags_ppc_}
+ ${X86_FLAGS[*]/#/cpu_flags_x86_}
+"
RDEPEND="
lapack? (
- >=virtual/cblas-3.8
- >=virtual/lapack-3.8
+ >=virtual/cblas-3.8[index64(-)?]
+ >=virtual/lapack-3.8[index64(-)?]
)
"
BDEPEND="
@@ -56,12 +71,107 @@ EPYTEST_PLUGINS=( hypothesis pytest-timeout )
EPYTEST_XDIST=1
distutils_enable_tests pytest
+has_all_x86() {
+ local flag
+ for flag; do
+ if ! use "cpu_flags_x86_${flag}"; then
+ return 1
+ fi
+ done
+ return 0
+}
+
python_configure_all() {
+ local cpu_baseline=()
+ local map flag
+ case ${ARCH} in
+ arm)
+ # every flag implies the previous one
+ for map in NEON:neon NEON_FP16:neon-fp16 NEON_VFPV4:vfpv4; do
+ if ! use "cpu_flags_arm_${map#*:}"; then
+ break
+ fi
+ cpu_baseline+=( "${map%:*}" )
+ done
+ ;&
+ arm64)
+ # on 32-bit ARM, ASIMD implies all NEON* flags
+ # on 64-bit ARM, they are all linked together
+ if use arm64 ||
+ [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == NEON_VFPV4 ]]
+ then
+ cpu_baseline+=( $(usev cpu_flags_arm_asimd ASIMD) )
+ fi
+
+ # these two imply ASIMD
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMD ]]; then
+ for flag in dp hp; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_asimd${flag}" "ASIMD${flag^^}")
+ )
+ done
+ fi
+
+ # these two imply ASIMDHP
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMDHP ]]; then
+ for flag in asimdfhm sve; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_${flag}" "${flag^^}")
+ )
+ done
+ fi
+ ;;
+ ppc64)
+ # every flag implies the previous one
+ for flag in '' 2 3 4; do
+ if ! use "cpu_flags_ppc_vsx${flags}"; then
+ break
+ fi
+ cpu_baseline+=( "VSX${flag}" )
+ done
+ ;;
+ amd64|x86)
+ # upstream combines multiple instructions into sets
+ local mapping=(
+ # for these, we just check the newest instruction set,
+ # since all earlier instruction sets imply it
+ "X86_V2=sse4_2"
+ "X86_V3=avx2"
+ # from here on, we check all features that were added
+ # in the lowest CPU supporting them all
+ # https://en.wikipedia.org/wiki/AVX-512
+ "X86_V4=avx512bw avx512dq avx512vl"
+ "AVX512_ICL=avx512_vbmi2 avx512_bitalg"
+ "AVX512_SPR=avx512_bf16 avx512_fp16"
+ )
+
+ local m
+ for m in "${mapping[@]}"; do
+ local feature=${m%=*}
+ local sets=${m#*=}
+
+ if has_all_x86 ${sets}; then
+ einfo "${feature} enabled: all of ${sets} enabled"
+ cpu_baseline+=( "${feature}" )
+ else
+ einfo "${feature} disabled: not all of ${sets} enabled"
+ break
+ fi
+ done
+ ;;
+ *)
+ cpu_baseline=MIN
+ ;;
+ esac
+
DISTUTILS_ARGS=(
-Dallow-noblas=$(usex !lapack true false)
- -Dblas=$(usev lapack cblas)
- -Dlapack=$(usev lapack lapack)
- # TODO: cpu-* options
+ -Duse-ilp64=$(usex index64 true false)
+ -Dblas=$(usev lapack $(usex index64 cblas64 cblas))
+ -Dlapack=$(usev lapack $(usex index64 lapack64 lapack))
+ -Dcpu-baseline="${cpu_baseline[*]}"
+ -Dcpu-baseline-detect=disabled
+ -Dcpu-dispatch="$(usev cpudetection MAX)"
)
# bug #922457
@@ -71,6 +181,13 @@ python_configure_all() {
}
python_test() {
+ # We run tests in parallel, so avoid having n^2 threads in lapack
+ # tests.
+ local -x BLIS_NUM_THREADS=1
+ local -x MKL_NUM_THREADS=1
+ local -x OMP_NUM_THREADS=1
+ local -x OPENBLAS_NUM_THREADS=1
+
# don't run tests that require more than 2 GiB of RAM (per process)
local -x NPY_AVAILABLE_MEM="2 GiB"
@@ -86,8 +203,15 @@ python_test() {
# Flaky, reruns don't help
numpy/f2py/tests/test_crackfortran.py
+ numpy/f2py/tests/test_data.py::TestData{,F77}::test_crackedlines
+ numpy/f2py/tests/test_f2py2e.py::test_gen_pyf
numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
- numpy/f2py/tests/test_data.py::TestDataF77::test_crackedlines
+
+ # Broken by new setuptools
+ numpy/distutils/tests/test_fcompiler.py
+ numpy/distutils/tests/test_fcompiler_gnu.py
+ numpy/distutils/tests/test_fcompiler_intel.py
+ numpy/distutils/tests/test_fcompiler_nagfor.py
)
if [[ $(uname -m) == armv8l ]]; then
@@ -181,6 +305,20 @@ python_test() {
)
fi
+ case ${EPYTHON} in
+ pypy3.11)
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_regression.py::TestRegression::test_buffer_hashlib
+ numpy/random/tests/test_generator_mt19937.py::TestIntegers::test_repeatability
+ numpy/random/tests/test_generator_mt19937.py::TestRandomDist::test_choice_large_sample
+ numpy/random/tests/test_generator_mt19937.py::test_jumped
+ numpy/random/tests/test_random.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::test_integer_repeat
+ )
+ ;;
+ esac
+
cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
epytest
}