From c1f2af78d7929d71d43cf63191638ede4ba5b853 Mon Sep 17 00:00:00 2001 From: "Liguros - Gitlab CI/CD [develop]" Date: Mon, 26 Jun 2023 19:21:24 +0000 Subject: Adding metadata --- .../files/numpy-1.25.0-fix-long-double-check.patch | 151 +++++++++++++++++ ...y-1.25.0-skip-python3.12-irrelevant-tests.patch | 187 +++++++++++++++++++++ dev-python/numpy/numpy-1.25.0.ebuild | 7 +- 3 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 dev-python/numpy/files/numpy-1.25.0-fix-long-double-check.patch create mode 100644 dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch (limited to 'dev-python/numpy') diff --git a/dev-python/numpy/files/numpy-1.25.0-fix-long-double-check.patch b/dev-python/numpy/files/numpy-1.25.0-fix-long-double-check.patch new file mode 100644 index 000000000000..4f3ef21c93b3 --- /dev/null +++ b/dev-python/numpy/files/numpy-1.25.0-fix-long-double-check.patch @@ -0,0 +1,151 @@ +https://github.com/numpy/numpy/commit/de0b2d5c6dee9303c4a055e7591978ed5a06e403 + +From de0b2d5c6dee9303c4a055e7591978ed5a06e403 Mon Sep 17 00:00:00 2001 +From: matoro +Date: Sun, 18 Jun 2023 19:39:06 -0400 +Subject: [PATCH] BLD: Port long double identification to C for meson + +This ports the old Python code for identifying the long double +representation to C, so that it can be easily invoked by meson. The +original implementation is at https://github.com/numpy/numpy/blob/eead09a3d02c09374942cdc787c0b5e4fe9e7472/numpy/core/setup_common.py#L264-L434 + +The C portion of the code has been tested and confirmed to work on +systems with the following formats, either natively or via an +alternative ABI: INTEL_EXTENDED_16_BYTES_LE, IEEE_QUAD_BE, +IEEE_QUAD_LE, IBM_DOUBLE_DOUBLE_BE, IBM_DOUBLE_DOUBLE_LE, +IEEE_DOUBLE_BE, INTEL_EXTENDED_12_BYTES_LE. + +The original meson port includes an error condition with the comment +"This should not be possible, 12 bits of "content" should still result +in sizeof() being 16." As far as I can tell this is incorrect, as +compiling on an x86_64 system with 32-bit ABI (gcc -m32) does indeed +have sizeof(long double)==12. This is reflected in the C code. + +Closes gh-23972, closes +https://github.com/mesonbuild/meson/issues/11068. +--- + numpy/core/meson.build | 110 ++++++++++++++++++++++++++++++++--------- + 1 file changed, 87 insertions(+), 23 deletions(-) + +diff --git a/numpy/core/meson.build b/numpy/core/meson.build +index 3427de408f1..92b393e4bc1 100644 +--- a/numpy/core/meson.build ++++ b/numpy/core/meson.build +@@ -361,29 +361,93 @@ foreach intrin: optional_intrinsics + endif + endforeach + +-# long double representation detection (see setup_common.py) +-# TODO: this is still incomplete, and different from how it's done in the +-# numpy.distutils based build, see https://github.com/mesonbuild/meson/issues/11068 +-longdouble_size = cc.sizeof('long double') +-if longdouble_size == 8 +- if host_machine.endian() == 'little' +- longdouble_format = 'IEEE_DOUBLE_LE' +- else +- longdouble_format = 'IEEE_DOUBLE_BE' +- endif +-elif longdouble_size == 12 +- error('This should not be possible, 12 bits of "content" should still result in sizeof() being 16. Please report this error!' +- ) +-elif longdouble_size == 16 +- if host_machine.endian() == 'little' +- # FIXME: this varies, there's multiple formats here! Not yet implemented. +- # TBD how we deal with the mess of old long double formats. +- longdouble_format = 'INTEL_EXTENDED_16_BYTES_LE' +- else +- error('No idea what this is ....') +- endif +-else +- error('Unknown long double size: ' + londouble_size) ++# This is a port of the old python code for identifying the long double ++# representation to C. The old Python code is in this range: ++# https://github.com/numpy/numpy/blob/eead09a3d02c09374942cdc787c0b5e4fe9e7472/numpy/core/setup_common.py#L264-L434 ++# This port is in service of solving gh-23972 ++# as well as https://github.com/mesonbuild/meson/issues/11068 ++longdouble_format = meson.get_compiler('c').run( ++''' ++#include ++#include ++ ++#define repcmp(z) (memcmp((const char *)&foo.x, z, sizeof(foo.x)) == 0) ++ ++const struct { ++ char before[16]; ++ long double x; ++ char after[8]; ++} foo = {{'\0'}, -123456789.0, {'\0'}}; ++ ++int main(void) { ++ switch (sizeof(foo.x)) { ++ case 8: { ++ if (repcmp( ++ ((const char[]){0000, 0000, 0000, 0124, 0064, 0157, 0235, 0301}))) { ++ fprintf(stdout, "IEEE_DOUBLE_LE"); ++ return 0; ++ } ++ if (repcmp( ++ ((const char[]){0301, 0235, 0157, 0064, 0124, 0000, 0000, 0000}))) { ++ fprintf(stdout, "IEEE_DOUBLE_BE"); ++ return 0; ++ } ++ fprintf(stdout, "UNKNOWN"); ++ return 1; ++ } ++ case 12: { ++ if (repcmp(((const char[]){0000, 0000, 0000, 0000, 0240, 0242, 0171, 0353, ++ 0031, 0300, 0000, 0000}))) { ++ fprintf(stdout, "INTEL_EXTENDED_12_BYTES_LE"); ++ return 0; ++ } ++ if (repcmp(((const char[]){0300, 0031, 0000, 0000, 0353, 0171, 0242, 0240, ++ 0000, 0000, 0000, 0000}))) { ++ fprintf(stdout, "MOTOROLA_EXTENDED_12_BYTES_BE"); ++ return 0; ++ } ++ fprintf(stdout, "UNKNOWN"); ++ return 1; ++ } ++ case 16: { ++ if (repcmp( ++ ((const char[]){0000, 0000, 0000, 0000, 0240, 0242, 0171, 0353, ++ 0031, 0300, 0000, 0000, 0000, 0000, 0000, 0000}))) { ++ fprintf(stdout, "INTEL_EXTENDED_16_BYTES_LE"); ++ return 0; ++ } ++ if (repcmp( ++ ((const char[]){0300, 0031, 0326, 0363, 0105, 0100, 0000, 0000, ++ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000}))) { ++ fprintf(stdout, "IEEE_QUAD_BE"); ++ return 0; ++ } ++ if (repcmp( ++ ((const char[]){0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, ++ 0000, 0000, 0100, 0105, 0363, 0326, 0031, 0300}))) { ++ fprintf(stdout, "IEEE_QUAD_LE"); ++ return 0; ++ } ++ if (repcmp( ++ ((const char[]){0000, 0000, 0000, 0124, 0064, 0157, 0235, 0301, ++ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000}))) { ++ fprintf(stdout, "IBM_DOUBLE_DOUBLE_LE"); ++ return 0; ++ } ++ if (repcmp( ++ ((const char[]){0301, 0235, 0157, 0064, 0124, 0000, 0000, 0000, ++ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000}))) { ++ fprintf(stdout, "IBM_DOUBLE_DOUBLE_BE"); ++ return 0; ++ } ++ fprintf(stdout, "UNKNOWN"); ++ return 1; ++ } ++ } ++} ++''').stdout() ++if longdouble_format == 'UNKNOWN' or longdouble_format == 'UNDEFINED' ++ error('Unknown long double format of size: ' + cc.sizeof('long double').to_string()) + endif + cdata.set10('HAVE_LDOUBLE_' + longdouble_format, true) + + diff --git a/dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch b/dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch new file mode 100644 index 000000000000..cd829c5ef08e --- /dev/null +++ b/dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch @@ -0,0 +1,187 @@ +https://github.com/numpy/numpy/commit/515403f2c637cb58f8dc326d88dd6f768f027cf4 +https://github.com/numpy/numpy/commit/b0872b858e2e6ebc394e95c81a024dcf1573c690 +https://github.com/numpy/numpy/commit/e42fc93b54a6d41dab72d86921f96e5ebc4c4198 +https://github.com/numpy/numpy/commit/4552b6cb0083502f731794e961cd30b9b62ba2e3 + +From 515403f2c637cb58f8dc326d88dd6f768f027cf4 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers +Date: Sun, 18 Jun 2023 15:56:23 +0200 +Subject: [PATCH] TST: disable `test_new_policy` test for memory allocator. + +This is way too slow, running a large part of the test suite twice. +Issue 23975 tracks changing how this feature is tested. +--- + numpy/core/tests/test_mem_policy.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/numpy/core/tests/test_mem_policy.py b/numpy/core/tests/test_mem_policy.py +index b4e2f65916c..0855d60771a 100644 +--- a/numpy/core/tests/test_mem_policy.py ++++ b/numpy/core/tests/test_mem_policy.py +@@ -359,7 +359,7 @@ def test_thread_locality(get_module): + assert np.core.multiarray.get_handler_name() == orig_policy_name + + +-@pytest.mark.slow ++@pytest.mark.skip(reason="too slow, see gh-23975") + def test_new_policy(get_module): + a = np.arange(10) + orig_policy_name = np.core.multiarray.get_handler_name(a) + +From b0872b858e2e6ebc394e95c81a024dcf1573c690 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers +Date: Mon, 19 Jun 2023 11:07:19 +0200 +Subject: [PATCH] TST: skip refcount related tests on py312 + +Python 3.12 has immortal refcounts; the initial and final +values will be the same when accessing `sys.getrefcount` inside a +test. + +Closes gh-23986 +--- a/numpy/core/tests/test_dtype.py ++++ b/numpy/core/tests/test_dtype.py +@@ -755,6 +755,11 @@ def iter_struct_object_dtypes(): + yield pytest.param(dt, p, 12, obj, id="") + + ++@pytest.mark.skipif( ++ sys.version_info >= (3, 12), ++ reason="Python 3.12 has immortal refcounts, this test will no longer " ++ "work. See gh-23986" ++) + @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") + class TestStructuredObjectRefcounting: + """These tests cover various uses of complicated structured types which +--- a/numpy/core/tests/test_regression.py ++++ b/numpy/core/tests/test_regression.py +@@ -1465,6 +1465,10 @@ def test_structured_arrays_with_objects1(self): + x[x.nonzero()] = x.ravel()[:1] + assert_(x[0, 1] == x[0, 0]) + ++ @pytest.mark.skipif( ++ sys.version_info >= (3, 12), ++ reason="Python 3.12 has immortal refcounts, this test no longer works." ++ ) + @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") + def test_structured_arrays_with_objects2(self): + # Ticket #1299 second test + +From e42fc93b54a6d41dab72d86921f96e5ebc4c4198 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers +Date: Mon, 19 Jun 2023 11:14:38 +0200 +Subject: [PATCH] TST: skip memory allocator and `array_interface` tests on + py312 + +They require numpy.distutils, which isn't available on >=3.12 +The `numpy.testing.extbuild` utility will need changing to make this +work again. Could either use plain `setuptools` or `meson`. +--- a/numpy/core/tests/test_array_interface.py ++++ b/numpy/core/tests/test_array_interface.py +@@ -128,6 +128,9 @@ def get_module(tmp_path): + more_init=more_init) + + ++# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on ++# Python 3.12 and up. ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + @pytest.mark.slow + def test_cstruct(get_module): + +--- a/numpy/core/tests/test_mem_policy.py ++++ b/numpy/core/tests/test_mem_policy.py +@@ -9,6 +9,11 @@ + import sys + + ++# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on ++# Python 3.12 and up. It's an internal test utility, so for now we just skip ++# these tests. ++ ++ + @pytest.fixture + def get_module(tmp_path): + """ Add a memory policy that returns a false pointer 64 bytes into the +@@ -213,6 +218,7 @@ def get_module(tmp_path): + more_init=more_init) + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_set_policy(get_module): + + get_handler_name = np.core.multiarray.get_handler_name +@@ -241,6 +247,7 @@ def test_set_policy(get_module): + assert get_handler_name() == orig_policy_name + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_default_policy_singleton(get_module): + get_handler_name = np.core.multiarray.get_handler_name + +@@ -262,6 +269,7 @@ def test_default_policy_singleton(get_module): + assert def_policy_1 is def_policy_2 is get_module.get_default_policy() + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_policy_propagation(get_module): + # The memory policy goes hand-in-hand with flags.owndata + +@@ -320,6 +328,7 @@ async def async_test_context_locality(get_module): + assert np.core.multiarray.get_handler_name() == orig_policy_name + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_context_locality(get_module): + if (sys.implementation.name == 'pypy' + and sys.pypy_version_info[:3] < (7, 3, 6)): +@@ -341,6 +350,7 @@ def concurrent_thread2(get_module, event): + get_module.set_secret_data_policy() + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_thread_locality(get_module): + orig_policy_name = np.core.multiarray.get_handler_name() + +@@ -359,6 +369,7 @@ def test_thread_locality(get_module): + assert np.core.multiarray.get_handler_name() == orig_policy_name + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + @pytest.mark.skip(reason="too slow, see gh-23975") + def test_new_policy(get_module): + a = np.arange(10) +@@ -388,6 +399,8 @@ def test_new_policy(get_module): + c = np.arange(10) + assert np.core.multiarray.get_handler_name(c) == orig_policy_name + ++ ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + @pytest.mark.xfail(sys.implementation.name == "pypy", + reason=("bad interaction between getenv and " + "os.environ inside pytest")) +@@ -420,6 +433,8 @@ def test_switch_owner(get_module, policy): + else: + os.environ['NUMPY_WARN_IF_NO_MEM_POLICY'] = oldval + ++ ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_owner_is_base(get_module): + a = get_module.get_array_with_base() + with pytest.warns(UserWarning, match='warn_on_free'): + + +From 4552b6cb0083502f731794e961cd30b9b62ba2e3 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers +Date: Mon, 19 Jun 2023 12:07:32 +0200 +Subject: [PATCH] TST: skip test using `np.load` on py2-saved .npy file on + py312 + +--- a/numpy/lib/tests/test_format.py ++++ b/numpy/lib/tests/test_format.py +@@ -527,6 +527,7 @@ def test_load_padded_dtype(tmpdir, dt): + assert_array_equal(arr, arr1) + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="see gh-23988") + @pytest.mark.xfail(IS_WASM, reason="Emscripten NODEFS has a buggy dup") + def test_python2_python3_interoperability(): + fname = 'win64python2.npy' diff --git a/dev-python/numpy/numpy-1.25.0.ebuild b/dev-python/numpy/numpy-1.25.0.ebuild index dd214428826b..80d2e86dac8a 100644 --- a/dev-python/numpy/numpy-1.25.0.ebuild +++ b/dev-python/numpy/numpy-1.25.0.ebuild @@ -22,7 +22,7 @@ LICENSE="BSD" SLOT="0" IUSE="lapack" if [[ ${PV} != *_rc* ]] ; then - KEYWORDS="~amd64" + KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc64" fi RDEPEND=" @@ -52,6 +52,8 @@ BDEPEND=" PATCHES=( "${FILESDIR}"/${PN}-1.25.0_rc1-meson-pyproject.toml.patch + "${FILESDIR}"/${PN}-1.25.0-skip-python3.12-irrelevant-tests.patch + "${FILESDIR}"/${PN}-1.25.0-fix-long-double-check.patch ) distutils_enable_tests pytest @@ -107,6 +109,9 @@ python_test() { EPYTEST_DESELECT+=( # too large for 32-bit platforms core/tests/test_ufunc.py::TestUfunc::test_identityless_reduction_huge_array + 'core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]' + 'core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]' + lib/tests/test_histograms.py::TestHistogram::test_big_arrays ) ;; *) -- cgit v1.3.1