diff options
Diffstat (limited to 'dev-python/flatbuffers')
-rw-r--r-- | dev-python/flatbuffers/Manifest | 2 | ||||
-rw-r--r-- | dev-python/flatbuffers/files/flatbuffers-24.3.25-numpy-2.patch | 72 | ||||
-rw-r--r-- | dev-python/flatbuffers/flatbuffers-24.3.25-r1.ebuild | 46 |
3 files changed, 120 insertions, 0 deletions
diff --git a/dev-python/flatbuffers/Manifest b/dev-python/flatbuffers/Manifest index f86d7e41f84e..66f469ee53c4 100644 --- a/dev-python/flatbuffers/Manifest +++ b/dev-python/flatbuffers/Manifest @@ -1,3 +1,5 @@ +AUX flatbuffers-24.3.25-numpy-2.patch 2623 BLAKE2B 8a5df9dc31b4b1e46a8fe4b5bdce363ddadf96bbe36561ad1f1d51d5b402948194c838e7a2fa8ef77a49a79f6809f2c0606292fe4bfb1f97fa6bad2250da240e SHA512 f02957a07928be1845b258a85e1983ca2799e1838c9b57957841f05c4de13da8b5c50cb7c5584c104e3a9b8dcc35fe4d36fb393e363b79b25c97d8a45ea16b4a DIST flatbuffers-24.3.25.gh.tar.gz 2297829 BLAKE2B f3a5a94119a1b1b63fba9126e1cdff7ab712996bfc0d65626a679405f62dfa722bc5de244ef775fba336224b60feff3aa27acf54bed027c4013590b4afbefe7c SHA512 e2a614f4fc526ce07bfe1e1bc79efd3c87acbdb93aee7b42994d4855abd2593f36b5ca1edb53c7dcd470d5fbe14a3e394bd75dcebb4458cc0aeb33d622a3c662 +EBUILD flatbuffers-24.3.25-r1.ebuild 974 BLAKE2B 9413946e58ceeb190060ab2fc0ef40037460d2a9a031778bd15398e9fcfde839d45ebdf341e06549a01c67f008406764917302930d067f1fe1e4b8235118139a SHA512 b8b1c1841acca6922b7bbdf90ceb5fef882f7efa95333079a3a45e9050c4ced6e812dd52921b7df9e16c1454511125b870bb7387ada28c286a0e1f3ac91448dd EBUILD flatbuffers-24.3.25.ebuild 831 BLAKE2B 826a9835270ba4b4a20a1aff553378b5dd49133fbc9df1c20693bbe1ef7023e1df94287931beb9e5f336a39d980848fea206436f60328074f7397df5f75be50d SHA512 f446d3c53c17e2a8f7f80bf8ba0255fee8f908bcc5822886cdd32666fa4095dc7bd735954e89371ed249490015420d284a8d920b50a834236d1d65f55a6a124c MISC metadata.xml 397 BLAKE2B 2407f1c42b05c20ddeaf0ddce303c24604be89323c35c68a0770b221f44c4fe9e0c6580e7d5f9e50d3e263f81b26935c250e45634279285ebf2c5d327220122b SHA512 635f3e14f3aa038bf8b2b7bf321e48fe4496048a11b337bab0589bab924135f8b1d216329d9326ba214e1db202ed390722345c69e3260327c2e103f5feb7fa31 diff --git a/dev-python/flatbuffers/files/flatbuffers-24.3.25-numpy-2.patch b/dev-python/flatbuffers/files/flatbuffers-24.3.25-numpy-2.patch new file mode 100644 index 000000000000..cc5846404764 --- /dev/null +++ b/dev-python/flatbuffers/files/flatbuffers-24.3.25-numpy-2.patch @@ -0,0 +1,72 @@ +From d053fbd391610e72fff1f8ee02c1222305f15de9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <arkamar@gentoo.org> +Date: Mon, 1 Jul 2024 10:29:39 +0000 +Subject: [PATCH] Support for Numpy 2.0 in tests + +The newbyteorder has been removed in Numpy 2.0 [1]. Its usages are +replaced with respect to migration guide. + +[1] https://numpy.org/devdocs/numpy_2_0_migration_guide.html#ndarray-and-scalar-methods + +Fixes: #8332 + +Upstream-PR: https://github.com/google/flatbuffers/pull/8346 + +diff --git a/tests/py_test.py b/tests/py_test.py +index 7d6c0a37966..fc13a490f71 100644 +--- a/tests/py_test.py ++++ b/tests/py_test.py +@@ -1095,7 +1095,7 @@ def test_create_numpy_vector_int8(self): + + # Reverse endian: + b = flatbuffers.Builder(0) +- x_other_endian = x.byteswap().newbyteorder() ++ x_other_endian = x.byteswap().view(x.dtype.newbyteorder()) + b.CreateNumpyVector(x_other_endian) + self.assertBuilderEquals( + b, +@@ -1144,7 +1144,7 @@ def test_create_numpy_vector_uint16(self): + + # Reverse endian: + b = flatbuffers.Builder(0) +- x_other_endian = x.byteswap().newbyteorder() ++ x_other_endian = x.byteswap().view(x.dtype.newbyteorder()) + b.CreateNumpyVector(x_other_endian) + self.assertBuilderEquals( + b, +@@ -1213,7 +1213,7 @@ def test_create_numpy_vector_int64(self): + + # Reverse endian: + b = flatbuffers.Builder(0) +- x_other_endian = x.byteswap().newbyteorder() ++ x_other_endian = x.byteswap().view(x.dtype.newbyteorder()) + b.CreateNumpyVector(x_other_endian) + self.assertBuilderEquals( + b, +@@ -1287,7 +1287,7 @@ def test_create_numpy_vector_float32(self): + + # Reverse endian: + b = flatbuffers.Builder(0) +- x_other_endian = x.byteswap().newbyteorder() ++ x_other_endian = x.byteswap().view(x.dtype.newbyteorder()) + b.CreateNumpyVector(x_other_endian) + self.assertBuilderEquals( + b, +@@ -1361,7 +1361,7 @@ def test_create_numpy_vector_float64(self): + + # Reverse endian: + b = flatbuffers.Builder(0) +- x_other_endian = x.byteswap().newbyteorder() ++ x_other_endian = x.byteswap().view(x.dtype.newbyteorder()) + b.CreateNumpyVector(x_other_endian) + self.assertBuilderEquals( + b, +@@ -1427,7 +1427,7 @@ def test_create_numpy_vector_bool(self): + + # Reverse endian: + b = flatbuffers.Builder(0) +- x_other_endian = x.byteswap().newbyteorder() ++ x_other_endian = x.byteswap().view(x.dtype.newbyteorder()) + b.CreateNumpyVector(x_other_endian) + self.assertBuilderEquals( + b, diff --git a/dev-python/flatbuffers/flatbuffers-24.3.25-r1.ebuild b/dev-python/flatbuffers/flatbuffers-24.3.25-r1.ebuild new file mode 100644 index 000000000000..e82e5d455faa --- /dev/null +++ b/dev-python/flatbuffers/flatbuffers-24.3.25-r1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..13} ) + +inherit distutils-r1 + +DESCRIPTION="RFC 7049 - Concise Binary Object Representation" +HOMEPAGE=" + https://github.com/google/flatbuffers/ + https://pypi.org/project/flatbuffers/ +" +SRC_URI=" + https://github.com/google/${PN}/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz +" +S=${WORKDIR}/${P}/python + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~sparc ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +BDEPEND=" + test? ( + dev-python/numpy[${PYTHON_USEDEP}] + ) +" + +src_prepare() { + cd "${WORKDIR}/${P}" || die + eapply "${FILESDIR}/${PN}-24.3.25-numpy-2.patch" + cd "${S}" || die + distutils-r1_src_prepare +} + +python_test() { + cd "${WORKDIR}/${P}/tests" || die + # zeroes means without benchmarks + "${EPYTHON}" py_test.py 0 0 0 0 false || die + "${EPYTHON}" py_flexbuffers_test.py -v || die +} |