package/python-numpy: bump version to 2.4.0

Release notes: https://numpy.org/news/

Add new supported architectures.

License hash changed due to date update:
c1ffdbc0c2

We need to build python-numpy with its vendored version of meson as
it currently relies on features that are not yet upstream. To do this
we can simply set the PYTHONPATH with the vendored meson path before
the normal PYTHON3_PATH so that the vendored version will have
precedence. We need to set this for both host and target numpy.

We also need to set the architecture specific longdouble_format
property as numpy is unable to determine the value for this without
being able to execute target binaries.

See:
3e7e5c3cab/doc/source/building/cross_compilation.rst

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[Bernd:
 Bumped to 2.4.0

 Removed patch which is included in this release.

 Updated license hashes due to upstream commits:
 - copyright year bumps:
   https://github.com/numpy/numpy/commits/v2.4.0/LICENSE.txt
 - file move
   tools/npy_tempita/license.txt -> numpy/_build_utils/tempita/LICENSE.txt
   63a1fee8d1
   86940987a9
 - directory move core -> _core and various code updates
   https://github.com/numpy/numpy/commits/v2.4.0/numpy/_core/src/multiarray/dragon4.c
 - directory move core -> _core
   https://github.com/numpy/numpy/commits/v2.4.0/numpy/_core/include/numpy/libdivide/LICENSE.txt

 Following Romain's review
 https://lists.buildroot.org/pipermail/buildroot/2024-November/767739.html
 host-python-numpy was switched back to host-python-package to install the
 f2py script needed by the upcoming bump of python-scipy. A dependency to
 host-python-meson-python is also needed.

 Removed PYTHON_NUMPY_LONGDOUBLE_FORMAT configure option for BR2_arceb
 after this arch was removed from buildroot.

 Changed path in PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES following
 upstream commit
 923f219077
 and updated opencv4 as well]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>

Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
James Hilliard
2026-01-02 16:26:30 +01:00
committed by Julien Olivain
parent 3a6e2b4a03
commit 62648d9892
5 changed files with 80 additions and 51 deletions

View File

@@ -400,7 +400,7 @@ OPENCV4_CONF_OPTS += \
-DPYTHON3_EXECUTABLE=$(HOST_DIR)/bin/python3 \
-DPYTHON3_INCLUDE_PATH=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR) \
-DPYTHON3_LIBRARIES=$(STAGING_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR).so \
-DPYTHON3_NUMPY_INCLUDE_DIRS=$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy/core/include \
-DPYTHON3_NUMPY_INCLUDE_DIRS=$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy/_core/include \
-DPYTHON3_PACKAGES_PATH=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
-DPYTHON3_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION)
OPENCV4_DEPENDENCIES += python3

View File

@@ -1,34 +0,0 @@
From 6dc2fd31f8a5a4ef502cb7734f004f5bce94e671 Mon Sep 17 00:00:00 2001
From: Thomas A Caswell <tcaswell@gmail.com>
Date: Sat, 18 Nov 2023 16:46:52 -0500
Subject: [PATCH] MNT: do not use `long` type
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Removed as type at language level 3 in ed7e95912b6ed7d20e190fbf1aecb9f2a997d479
in cython
Upstream: https://github.com/numpy/numpy/commit/6dc2fd31f8a5a4ef502cb7734f004f5bce94e671
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
---
numpy/random/_generator.pyx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx
index d067e795eb5c..ae481d69d696 100644
--- a/numpy/random/_generator.pyx
+++ b/numpy/random/_generator.pyx
@@ -3757,7 +3757,7 @@ def multivariate_normal(self, mean, cov, size=None, check_valid='warn',
if size is None:
shape = []
- elif isinstance(size, (int, long, np.integer)):
+ elif isinstance(size, (int, np.integer)):
shape = [size]
else:
shape = size
--
2.49.1

View File

@@ -3,15 +3,21 @@ config BR2_PACKAGE_PYTHON_NUMPY_ARCH_SUPPORTS
# Numpy has some CPU specific code
default y if BR2_arc
default y if BR2_aarch64
default y if BR2_aarch64_be
default y if BR2_arm
default y if BR2_armeb
default y if BR2_i386
default y if BR2_m68k
default y if BR2_mips
default y if BR2_mipsel
default y if BR2_or1k
default y if BR2_powerpc
default y if BR2_powerpc64
default y if BR2_powerpc64le
default y if BR2_riscv
default y if BR2_sh
default y if BR2_sparc
default y if BR2_sparc64
default y if BR2_x86_64
config BR2_PACKAGE_PYTHON_NUMPY

View File

@@ -1,8 +1,9 @@
# Copied from https://github.com/numpy/numpy/releases/tag/v1.25.0
sha256 f1accae9a28dc3cda46a91de86acf69de0d1b5f4edd44a9b0c3ceb8036dfff19 numpy-1.25.0.tar.gz
# md5, sha256 from https://pypi.org/pypi/numpy/json
md5 828b6c6df0b6f89b5cf799314d4ee2b6 numpy-2.4.0.tar.gz
sha256 6e504f7b16118198f138ef31ba24d985b124c2c469fe8467007cf30fd992f934 numpy-2.4.0.tar.gz
# License files, locally calculated
sha256 1034d3bd61783f3b5e7ec3e7ca818f4da4135132323a0ef99f4c0edb3c7f6bd2 LICENSE.txt
sha256 c27d0a8026bdb8876562b720ab24d1688e3827a89f6083cd6e7e8caa9584aba3 numpy/core/src/multiarray/dragon4.c
sha256 fbc539f47d0cf83bc61378080fb873d5c14630126cacbfe754035c3926daa5ec numpy/core/include/numpy/libdivide/LICENSE.txt
sha256 1be1df33863f97a7bc1c4d67980bd6c69c9a6fef0a5ee76e6ad6cb91e56e8491 LICENSE.txt
sha256 743b0f4a0087fe3607167113fffab6f2ca069c8da321763697ab5d0d8411634a numpy/_build_utils/tempita/LICENSE.txt
sha256 e09cfef237f1c47fec6c11926e23ed2222404d1e4357b5d65e65a2daf9d83949 numpy/_core/src/multiarray/dragon4.c
sha256 fbc539f47d0cf83bc61378080fb873d5c14630126cacbfe754035c3926daa5ec numpy/_core/include/numpy/libdivide/LICENSE.txt
sha256 a14cc25e10d40a3aa705b7de2fb764a6535d8ee9b2db4e1724900585457dfd55 numpy/linalg/lapack_lite/LICENSE.txt
sha256 badf51c7e3e7de9c7630bd069780f5c197b846ef7660b342a1e58d5553592d8e tools/npy_tempita/license.txt

View File

@@ -4,25 +4,28 @@
#
################################################################################
PYTHON_NUMPY_VERSION = 1.25.0
PYTHON_NUMPY_VERSION = 2.4.0
PYTHON_NUMPY_SOURCE = numpy-$(PYTHON_NUMPY_VERSION).tar.gz
PYTHON_NUMPY_SITE = https://github.com/numpy/numpy/releases/download/v$(PYTHON_NUMPY_VERSION)
PYTHON_NUMPY_SITE = https://files.pythonhosted.org/packages/a4/7a/6a3d14e205d292b738db449d0de649b373a59edb0d0b4493821d0a3e8718
PYTHON_NUMPY_LICENSE = BSD-3-Clause, MIT, Zlib
PYTHON_NUMPY_LICENSE_FILES = \
LICENSE.txt \
numpy/core/src/multiarray/dragon4.c \
numpy/core/include/numpy/libdivide/LICENSE.txt \
numpy/linalg/lapack_lite/LICENSE.txt \
tools/npy_tempita/license.txt
numpy/_build_utils/tempita/LICENSE.txt \
numpy/_core/src/multiarray/dragon4.c \
numpy/_core/include/numpy/libdivide/LICENSE.txt \
numpy/linalg/lapack_lite/LICENSE.txt
PYTHON_NUMPY_CPE_ID_VENDOR = numpy
PYTHON_NUMPY_CPE_ID_PRODUCT = numpy
PYTHON_NUMPY_DEPENDENCIES = host-python-cython python3
HOST_PYTHON_NUMPY_DEPENDENCIES = host-python-cython
HOST_PYTHON_NUMPY_DEPENDENCIES = host-python-cython host-python-meson-python
PYTHON_NUMPY_CONF_ENV += \
_PYTHON_SYSCONFIGDATA_NAME=$(PKG_PYTHON_SYSCONFIGDATA_NAME) \
PYTHONPATH=$(PYTHON3_PATH)
PYTHONPATH="$(@D)/vendored-meson/meson:$(PYTHON3_PATH)"
PYTHON_NUMPY_NINJA_ENV += \
PYTHONPATH="$(@D)/vendored-meson/meson:$(PYTHON3_PATH)"
ifeq ($(BR2_PACKAGE_LAPACK),y)
PYTHON_NUMPY_DEPENDENCIES += lapack
@@ -38,6 +41,59 @@ else
PYTHON_NUMPY_CONF_OPTS += -Dblas=""
endif
# Generated by running this test program under QEMU:
# https://github.com/numpy/numpy/blob/v1.26.4/numpy/core/meson.build#L376-L455
ifeq ($(BR2_arcle),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_LE
else ifeq ($(BR2_aarch64),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_QUAD_LE
else ifeq ($(BR2_aarch64_be),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_QUAD_BE
else ifeq ($(BR2_arm),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_LE
else ifeq ($(BR2_armeb),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_BE
else ifeq ($(BR2_i386),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = INTEL_EXTENDED_12_BYTES_LE
else ifeq ($(BR2_or1k),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_BE
else ifeq ($(BR2_m68k),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = MOTOROLA_EXTENDED_12_BYTES_BE
else ifeq ($(BR2_mips),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_BE
else ifeq ($(BR2_mipsel),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_LE
else ifeq ($(BR2_powerpc),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IBM_DOUBLE_DOUBLE_BE
else ifeq ($(BR2_powerpc64),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IBM_DOUBLE_DOUBLE_BE
else ifeq ($(BR2_powerpc64le),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IBM_DOUBLE_DOUBLE_LE
else ifeq ($(BR2_riscv),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_QUAD_LE
else ifeq ($(BR2_sh4)$(BR2_sh4a),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_LE
else ifeq ($(BR2_sh4eb)$(BR2_sh4aeb),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_BE
else ifeq ($(BR2_sparc),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_DOUBLE_BE
else ifeq ($(BR2_sparc64),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = IEEE_QUAD_BE
else ifeq ($(BR2_x86_64),y)
PYTHON_NUMPY_LONGDOUBLE_FORMAT = INTEL_EXTENDED_16_BYTES_LE
endif
PYTHON_NUMPY_MESON_EXTRA_PROPERTIES = \
longdouble_format='$(PYTHON_NUMPY_LONGDOUBLE_FORMAT)'
HOST_PYTHON_NUMPY_SETUP_TYPE = setuptools
HOST_PYTHON_NUMPY_CONF_ENV += \
PYTHONPATH="$(@D)/vendored-meson/meson:$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)"
HOST_PYTHON_NUMPY_NINJA_ENV += \
PYTHONPATH="$(@D)/vendored-meson/meson:$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)"
# Rather than add a host-blas or host-lapack dependencies, just use unoptimized,
# in-tree code.
HOST_PYTHON_NUMPY_CONF_OPTS = -Dblas="" -Dlapack=""
@@ -50,7 +106,7 @@ HOST_PYTHON_NUMPY_CONF_OPTS = -Dblas="" -Dlapack=""
# config path for their package environment.
define PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
$(SED) '/^pkgdir=/d;/^prefix=/i pkgdir=$(PYTHON3_PATH)/site-packages/numpy/core' \
$(PYTHON3_PATH)/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini
$(PYTHON3_PATH)/site-packages/numpy/_core/lib/npy-pkg-config/npymath.ini
endef
PYTHON_NUMPY_POST_INSTALL_STAGING_HOOKS += PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
@@ -59,4 +115,4 @@ PYTHON_NUMPY_POST_INSTALL_STAGING_HOOKS += PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FIL
PYTHON_NUMPY_INSTALL_STAGING = YES
$(eval $(meson-package))
$(eval $(host-meson-package))
$(eval $(host-python-package))