From 72ffe75e2f4ab141c4f7369f19b8b6b3d69af31ff1bbd7f4450fdcf45bfb8085 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 17 Sep 2021 21:26:07 +0000 Subject: [PATCH 1/3] Accepting request 919789 from home:schubi2 - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/919789 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=93 --- python-numpy.changes | 5 +++++ python-numpy.spec | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/python-numpy.changes b/python-numpy.changes index c474002..18543d9 100644 --- a/python-numpy.changes +++ b/python-numpy.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Aug 22 16:28:30 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Fri Jul 16 15:14:36 UTC 2021 - Ben Greiner diff --git a/python-numpy.spec b/python-numpy.spec index e6b4aff..1fe6b38 100644 --- a/python-numpy.spec +++ b/python-numpy.spec @@ -1,5 +1,5 @@ # -# spec file +# spec file for package python-numpy # # Copyright (c) 2021 SUSE LLC # @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + %global flavor @BUILD_FLAVOR@%{nil} %define ver 1.21.0 %define _ver 1_21_0 @@ -119,9 +125,13 @@ BuildRequires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc-devel BuildRequires: lua-lmod BuildRequires: suse-hpc Requires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc +%if %{with libalternatives} +Requires: alts +%else Requires(post): update-alternatives Requires(postun):update-alternatives %endif +%endif %python_subpackages %description @@ -194,7 +204,14 @@ export CFLAGS="%{optflags} -fno-strict-aliasing" %python_exec setup.py install --prefix=%{p_prefix} --root=%{buildroot} %if !%{with hpc} -%python_clone -a %{buildroot}%{_bindir}/f2py +%if ! %{with libalternatives} + %python_clone -a %{buildroot}%{_bindir}/f2py +%else + %python_clone %{buildroot}%{_bindir}/f2py + ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/f2py + mkdir -p %{buildroot}%{_datadir}/libalternatives/f2py + %python_expand echo "binary=%{_bindir}/f2py-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/f2py/10%{$python_version_nodots}.conf +%endif %endif %if 0%{?suse_version} @@ -283,17 +300,33 @@ popd %endif %if %{without hpc} +%if %{with libalternatives} +%pre +# removing old update-alternatives entries +if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then + %python_uninstall_alternative f2py +fi +%else %post %python_install_alternative f2py %postun %python_uninstall_alternative f2py %endif +%endif %files %{python_files} %doc README.md THANKS.txt %if %{without hpc} +%if ! 0%{with libalternatives} %python_alternative %{_bindir}/f2py +%else +%dir %{_datadir}/libalternatives +%dir %{_datadir}/libalternatives/f2py +%{_datadir}/libalternatives/f2py/10%python_version_nodots.conf +%{_bindir}/f2py +%{_bindir}/f2py-%python_version +%endif %if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" %{_bindir}/f2py3 %endif From b54abb607aec9f51ed96ba66a8a8a9233f18cea4c0a2775f83dad9ab5a9ebe3a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 19 Sep 2021 17:42:02 +0000 Subject: [PATCH 2/3] Accepting request 920176 from devel:languages:python:numeric revert - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/920176 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=94 --- python-numpy.changes | 5 ----- python-numpy.spec | 37 ++----------------------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/python-numpy.changes b/python-numpy.changes index 18543d9..c474002 100644 --- a/python-numpy.changes +++ b/python-numpy.changes @@ -1,8 +1,3 @@ -------------------------------------------------------------------- -Sun Aug 22 16:28:30 UTC 2021 - Stefan Schubert - -- Use libalternatives instead of update-alternatives. - ------------------------------------------------------------------- Fri Jul 16 15:14:36 UTC 2021 - Ben Greiner diff --git a/python-numpy.spec b/python-numpy.spec index 1fe6b38..e6b4aff 100644 --- a/python-numpy.spec +++ b/python-numpy.spec @@ -1,5 +1,5 @@ # -# spec file for package python-numpy +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -16,12 +16,6 @@ # -%if 0%{?suse_version} > 1500 -%bcond_without libalternatives -%else -%bcond_with libalternatives -%endif - %global flavor @BUILD_FLAVOR@%{nil} %define ver 1.21.0 %define _ver 1_21_0 @@ -125,13 +119,9 @@ BuildRequires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc-devel BuildRequires: lua-lmod BuildRequires: suse-hpc Requires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc -%if %{with libalternatives} -Requires: alts -%else Requires(post): update-alternatives Requires(postun):update-alternatives %endif -%endif %python_subpackages %description @@ -204,14 +194,7 @@ export CFLAGS="%{optflags} -fno-strict-aliasing" %python_exec setup.py install --prefix=%{p_prefix} --root=%{buildroot} %if !%{with hpc} -%if ! %{with libalternatives} - %python_clone -a %{buildroot}%{_bindir}/f2py -%else - %python_clone %{buildroot}%{_bindir}/f2py - ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/f2py - mkdir -p %{buildroot}%{_datadir}/libalternatives/f2py - %python_expand echo "binary=%{_bindir}/f2py-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/f2py/10%{$python_version_nodots}.conf -%endif +%python_clone -a %{buildroot}%{_bindir}/f2py %endif %if 0%{?suse_version} @@ -300,33 +283,17 @@ popd %endif %if %{without hpc} -%if %{with libalternatives} -%pre -# removing old update-alternatives entries -if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then - %python_uninstall_alternative f2py -fi -%else %post %python_install_alternative f2py %postun %python_uninstall_alternative f2py %endif -%endif %files %{python_files} %doc README.md THANKS.txt %if %{without hpc} -%if ! 0%{with libalternatives} %python_alternative %{_bindir}/f2py -%else -%dir %{_datadir}/libalternatives -%dir %{_datadir}/libalternatives/f2py -%{_datadir}/libalternatives/f2py/10%python_version_nodots.conf -%{_bindir}/f2py -%{_bindir}/f2py-%python_version -%endif %if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" %{_bindir}/f2py3 %endif From 0b4f6d23fef5ce77f3dfd82ade66770504e90d610f3058cc8c77c520810f2510 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 21 Sep 2021 09:17:03 +0000 Subject: [PATCH 3/3] Accepting request 920368 from home:bnavigator:branches:devel:languages:python:numeric - Update to 1.21.2 * #19497: MAINT: set Python version for 1.21.x to <3.11 * #19533: BUG: Fix an issue wherein importing numpy.typing could raise * #19646: MAINT: Update Cython version for Python 3.10. * #19648: TST: Bump the python 3.10 test version from beta4 to rc1 * #19651: TST: avoid distutils.sysconfig in runtests.py * #19652: MAINT: add missing dunder method to nditer type hints * #19656: BLD, SIMD: Fix testing extra checks when -Werror isn't applicable... * #19657: BUG: Remove logical object ufuncs with bool output * #19658: MAINT: Include .coveragerc in source distributions to support... * #19659: BUG: Fix bad write in masked iterator output copy paths * #19660: ENH: Add support for windows on arm targets * #19661: BUG: add base to templated arguments for platlib * #19662: BUG,DEP: Non-default UFunc signature/dtype usage should be deprecated * #19666: MAINT: Add Python 3.10 to supported versions. * #19668: TST,BUG: Sanitize path-separators when running runtest.py * #19671: BLD: load extra flags when checking for libflame * #19676: BLD: update circleCI docker image * #19677: REL: Prepare for 1.21.2 release. - Release 1.21.1 * #19311: REV,BUG: Replace NotImplemented with typing.Any * #19324: MAINT: Fixed the return-dtype of ndarray.real and imag * #19330: MAINT: Replace "dtype[Any]" with dtype in the definiton of... * #19342: DOC: Fix some docstrings that crash pdf generation. * #19343: MAINT: bump scipy-mathjax * #19347: BUG: Fix arr.flat.index for large arrays and big-endian machines * #19348: ENH: add numpy.f2py.get_include function * #19349: BUG: Fix reference count leak in ufunc dtype handling * #19350: MAINT: Annotate missing attributes of np.number subclasses * #19351: BUG: Fix cast safety and comparisons for zero sized voids OBS-URL: https://build.opensuse.org/request/show/920368 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=95 --- 0001-BUG-Fix-infinite-loop-on-gcc11.patch | 33 ------ numpy-1.21.0.zip | 3 - numpy-1.21.2.zip | 3 + numpy-pr19326-fix-subarray-segfault.patch | 125 ---------------------- python-numpy.changes | 54 ++++++++++ python-numpy.spec | 11 +- 6 files changed, 61 insertions(+), 168 deletions(-) delete mode 100644 0001-BUG-Fix-infinite-loop-on-gcc11.patch delete mode 100644 numpy-1.21.0.zip create mode 100644 numpy-1.21.2.zip delete mode 100644 numpy-pr19326-fix-subarray-segfault.patch diff --git a/0001-BUG-Fix-infinite-loop-on-gcc11.patch b/0001-BUG-Fix-infinite-loop-on-gcc11.patch deleted file mode 100644 index f585c85..0000000 --- a/0001-BUG-Fix-infinite-loop-on-gcc11.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 820cb97bcad0d171c9efbb8fb8d7e987a0514aa9 Mon Sep 17 00:00:00 2001 -From: Sayed Adel -Date: Fri, 2 Jul 2021 04:58:37 +0200 -Subject: [PATCH] BUG, SIMD: Fix infinite loop during count non-zero on GCC-11 - - The issue appears when the compiler miss inlining a function that - returns or accepts a SIMD vector. ---- - numpy/core/src/multiarray/item_selection.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c -index fb354ce5473..2b8ea9e79ac 100644 ---- a/numpy/core/src/multiarray/item_selection.c -+++ b/numpy/core/src/multiarray/item_selection.c -@@ -2131,7 +2131,7 @@ count_nonzero_bytes_384(const npy_uint64 * w) - - #if NPY_SIMD - /* Count the zero bytes between `*d` and `end`, updating `*d` to point to where to keep counting from. */ --static NPY_INLINE NPY_GCC_OPT_3 npyv_u8 -+NPY_FINLINE NPY_GCC_OPT_3 npyv_u8 - count_zero_bytes_u8(const npy_uint8 **d, const npy_uint8 *end, npy_uint8 max_count) - { - const npyv_u8 vone = npyv_setall_u8(1); -@@ -2150,7 +2150,7 @@ count_zero_bytes_u8(const npy_uint8 **d, const npy_uint8 *end, npy_uint8 max_cou - return vsum8; - } - --static NPY_INLINE NPY_GCC_OPT_3 npyv_u16x2 -+NPY_FINLINE NPY_GCC_OPT_3 npyv_u16x2 - count_zero_bytes_u16(const npy_uint8 **d, const npy_uint8 *end, npy_uint16 max_count) - { - npyv_u16x2 vsum16; diff --git a/numpy-1.21.0.zip b/numpy-1.21.0.zip deleted file mode 100644 index 1ba8415..0000000 --- a/numpy-1.21.0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e80fe25cba41c124d04c662f33f6364909b985f2eb5998aaa5ae4b9587242cce -size 10252686 diff --git a/numpy-1.21.2.zip b/numpy-1.21.2.zip new file mode 100644 index 0000000..a93fec1 --- /dev/null +++ b/numpy-1.21.2.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:423216d8afc5923b15df86037c6053bf030d15cc9e3224206ef868c2d63dd6dc +size 10264801 diff --git a/numpy-pr19326-fix-subarray-segfault.patch b/numpy-pr19326-fix-subarray-segfault.patch deleted file mode 100644 index 41077a1..0000000 --- a/numpy-pr19326-fix-subarray-segfault.patch +++ /dev/null @@ -1,125 +0,0 @@ -From be09bb6ba4d27fbd1f667d34bb2f11cccb446d65 Mon Sep 17 00:00:00 2001 -From: Gregory Lee -Date: Thu, 24 Jun 2021 08:37:01 -0400 -Subject: [PATCH 1/4] BUG: protect against access an attribute of a NULL - pointer - -Have PyArray_GetCastSafety return -1 if from is NULL ---- - numpy/core/src/multiarray/convert_datatype.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c -index d197a4bea31..716e5dd3d11 100644 ---- a/numpy/core/src/multiarray/convert_datatype.c -+++ b/numpy/core/src/multiarray/convert_datatype.c -@@ -417,6 +417,9 @@ PyArray_GetCastSafety( - if (to != NULL) { - to_dtype = NPY_DTYPE(to); - } -+ if (from == NULL) { -+ return -1; -+ } - PyObject *meth = PyArray_GetCastingImpl(NPY_DTYPE(from), to_dtype); - if (meth == NULL) { - return -1; -@@ -3293,8 +3296,10 @@ void_to_void_resolve_descriptors( - casting = NPY_NO_CASTING | _NPY_CAST_IS_VIEW; - } - } -- NPY_CASTING field_casting = PyArray_GetCastSafety( -- given_descrs[0]->subarray->base, given_descrs[1]->subarray->base, NULL); -+ -+ PyArray_Descr *from_base = (from_sub == NULL) ? NULL : from_sub->base; -+ PyArray_Descr *to_base = (to_sub == NULL) ? NULL : to_sub->base; -+ NPY_CASTING field_casting = PyArray_GetCastSafety(from_base, to_base, NULL); - if (field_casting < 0) { - return -1; - } - -From 3c901b49bd8715c93824c27682d81434d869498a Mon Sep 17 00:00:00 2001 -From: Gregory Lee -Date: Thu, 24 Jun 2021 11:16:22 -0400 -Subject: [PATCH 2/4] pass descriptor rather than null - ---- - numpy/core/src/multiarray/convert_datatype.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c -index 716e5dd3d11..1bba276d2d1 100644 ---- a/numpy/core/src/multiarray/convert_datatype.c -+++ b/numpy/core/src/multiarray/convert_datatype.c -@@ -417,9 +417,6 @@ PyArray_GetCastSafety( - if (to != NULL) { - to_dtype = NPY_DTYPE(to); - } -- if (from == NULL) { -- return -1; -- } - PyObject *meth = PyArray_GetCastingImpl(NPY_DTYPE(from), to_dtype); - if (meth == NULL) { - return -1; -@@ -3297,8 +3294,8 @@ void_to_void_resolve_descriptors( - } - } - -- PyArray_Descr *from_base = (from_sub == NULL) ? NULL : from_sub->base; -- PyArray_Descr *to_base = (to_sub == NULL) ? NULL : to_sub->base; -+ PyArray_Descr *from_base = (from_sub == NULL) ? given_descrs[0] : from_sub->base; -+ PyArray_Descr *to_base = (to_sub == NULL) ? given_descrs[1] : to_sub->base; - NPY_CASTING field_casting = PyArray_GetCastSafety(from_base, to_base, NULL); - if (field_casting < 0) { - return -1; - -From 8925fec4721b3a89e94d59b6149884d07fc581f4 Mon Sep 17 00:00:00 2001 -From: Gregory Lee -Date: Thu, 24 Jun 2021 11:44:37 -0400 -Subject: [PATCH 3/4] TST: test can_cast when only one argument has a subarray - ---- - numpy/core/tests/test_casting_unittests.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/numpy/core/tests/test_casting_unittests.py b/numpy/core/tests/test_casting_unittests.py -index 2cec1acd349..34f316d5ddc 100644 ---- a/numpy/core/tests/test_casting_unittests.py -+++ b/numpy/core/tests/test_casting_unittests.py -@@ -646,3 +646,9 @@ def test_object_to_parametric_internal_error(self): - with pytest.raises(TypeError, - match="casting from object to the parametric DType"): - cast._resolve_descriptors((np.dtype("O"), None)) -+ -+ def test_void_to_structured_with_subarray(self): -+ # test case corresponding to gh-19325 -+ dtype = np.dtype([("foo", " -Date: Thu, 24 Jun 2021 13:41:03 -0400 -Subject: [PATCH 4/4] TST: test both argument orders - ---- - numpy/core/tests/test_casting_unittests.py | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/numpy/core/tests/test_casting_unittests.py b/numpy/core/tests/test_casting_unittests.py -index 34f316d5ddc..d1924c1fda1 100644 ---- a/numpy/core/tests/test_casting_unittests.py -+++ b/numpy/core/tests/test_casting_unittests.py -@@ -647,8 +647,10 @@ def test_object_to_parametric_internal_error(self): - match="casting from object to the parametric DType"): - cast._resolve_descriptors((np.dtype("O"), None)) - -- def test_void_to_structured_with_subarray(self): -+ @pytest.mark.parametrize("casting", ["no", "unsafe"]) -+ def test_void_and_structured_with_subarray(self, casting): - # test case corresponding to gh-19325 - dtype = np.dtype([("foo", " + +- Update to 1.21.2 + * #19497: MAINT: set Python version for 1.21.x to <3.11 + * #19533: BUG: Fix an issue wherein importing numpy.typing could raise + * #19646: MAINT: Update Cython version for Python 3.10. + * #19648: TST: Bump the python 3.10 test version from beta4 to rc1 + * #19651: TST: avoid distutils.sysconfig in runtests.py + * #19652: MAINT: add missing dunder method to nditer type hints + * #19656: BLD, SIMD: Fix testing extra checks when -Werror isn't applicable... + * #19657: BUG: Remove logical object ufuncs with bool output + * #19658: MAINT: Include .coveragerc in source distributions to support... + * #19659: BUG: Fix bad write in masked iterator output copy paths + * #19660: ENH: Add support for windows on arm targets + * #19661: BUG: add base to templated arguments for platlib + * #19662: BUG,DEP: Non-default UFunc signature/dtype usage should be deprecated + * #19666: MAINT: Add Python 3.10 to supported versions. + * #19668: TST,BUG: Sanitize path-separators when running runtest.py + * #19671: BLD: load extra flags when checking for libflame + * #19676: BLD: update circleCI docker image + * #19677: REL: Prepare for 1.21.2 release. +- Release 1.21.1 + * #19311: REV,BUG: Replace NotImplemented with typing.Any + * #19324: MAINT: Fixed the return-dtype of ndarray.real and imag + * #19330: MAINT: Replace "dtype[Any]" with dtype in the definiton of... + * #19342: DOC: Fix some docstrings that crash pdf generation. + * #19343: MAINT: bump scipy-mathjax + * #19347: BUG: Fix arr.flat.index for large arrays and big-endian machines + * #19348: ENH: add numpy.f2py.get_include function + * #19349: BUG: Fix reference count leak in ufunc dtype handling + * #19350: MAINT: Annotate missing attributes of np.number subclasses + * #19351: BUG: Fix cast safety and comparisons for zero sized voids + * #19352: BUG: Correct Cython declaration in random + * #19353: BUG: protect against accessing base attribute of a NULL subarray + * #19365: BUG, SIMD: Fix detecting AVX512 features on Darwin + * #19366: MAINT: remove print()'s in distutils template handling + * #19390: ENH: SIMD architectures to show_config + * #19391: BUG: Do not raise deprecation warning for all nans in unique... + * #19392: BUG: Fix NULL special case in object-to-any cast code + * #19430: MAINT: Use arm64-graviton2 for testing on travis + * #19495: BUILD: update OpenBLAS to v0.3.17 + * #19496: MAINT: Avoid unicode characters in division SIMD code comments + * #19499: BUG, SIMD: Fix infinite loop during count non-zero on GCC-11 + * #19500: BUG: fix a numpy.npiter leak in npyiter_multi_index_set + * #19501: TST: Fix a GenericAlias test failure for python 3.9.0 + * #19502: MAINT: Start testing with Python 3.10.0b3. + * #19503: MAINT: Add missing dtype overloads for object- and ctypes-based... + * #19510: REL: Prepare for NumPy 1.21.1 release. +- Drop 0001-BUG-Fix-infinite-loop-on-gcc11.patch fixed upstream + (by gcc 11.2) +- Drop numpy-pr19326-fix-subarray-segfault.patch merged upstream + (backported) + ------------------------------------------------------------------- Fri Jul 16 15:14:36 UTC 2021 - Ben Greiner diff --git a/python-numpy.spec b/python-numpy.spec index e6b4aff..566de86 100644 --- a/python-numpy.spec +++ b/python-numpy.spec @@ -17,8 +17,8 @@ %global flavor @BUILD_FLAVOR@%{nil} -%define ver 1.21.0 -%define _ver 1_21_0 +%define ver 1.21.2 +%define _ver 1_21_2 %define pname python-numpy %define hpc_upcase_trans_hyph() %(echo %{**} | tr [a-z] [A-Z] | tr '-' '_') %if "%{flavor}" == "" @@ -77,11 +77,8 @@ Source99: python-numpy-rpmlintrc Patch0: numpy-buildfix.patch # PATCH-FIX-OPENSUSE numpy-1.9.0-remove-__declspec.patch -- fix for spurious compiler warnings that cause build failure Patch1: numpy-1.9.0-remove-__declspec.patch -# PATCH-FIX-UPSTREAM 0001-BUG-Fix-infinite-loop-on-gcc11.patch -Patch2: 0001-BUG-Fix-infinite-loop-on-gcc11.patch -# PATCH-FIX-UPSTREAM numpy-pr19326-fix-subarray-segfault.patch -- gh#numpy/numpy#19326 -Patch3: https://github.com/numpy/numpy/pull/19326.patch#/numpy-pr19326-fix-subarray-segfault.patch -BuildRequires: %{python_module Cython >= 0.29.23} +BuildConflicts: gcc11 < 11.2 +BuildRequires: %{python_module Cython >= 0.29.24} BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module devel} BuildRequires: %{python_module hypothesis >= 6.12.0}