From 3ce754598ad2bccb698d7ed07bf858d6869e5859 Mon Sep 17 00:00:00 2001 From: Wong Hoi Sing Edison Date: Sun, 24 Dec 2023 12:35:11 +0800 Subject: [PATCH] alvistack/v1.5.4 git clean -xdf tar zcvf ../python-scipy_1.5.4.orig.tar.gz --exclude=.git . debuild -uc -us cp python-scipy.spec ../python-scipy_1.5.4-1.spec cp ../python*-scipy*1.5.4*.{gz,xz,spec,dsc} /osc/home\:alvistack/scipy-scipy-1.5.4/ rm -rf ../python*-scipy*1.5.4*.* See https://github.com/scipy/scipy/pull/16719 Signed-off-by: Wong Hoi Sing Edison --- .gitignore | 2 + debian/.gitignore | 6 ++ debian/changelog | 5 + debian/control | 47 +++++++++ debian/copyright | 21 ++++ debian/python3-scipy.install | 1 + debian/python3-scipy.lintian-overrides | 4 + debian/rules | 15 +++ debian/source/format | 1 + debian/source/lintian-overrides | 5 + python-scipy.spec | 130 +++++++++++++++++++++++++ scipy/stats/_stats.pyx | 19 ++-- 12 files changed, 250 insertions(+), 6 deletions(-) create mode 100644 debian/.gitignore create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/python3-scipy.install create mode 100644 debian/python3-scipy.lintian-overrides create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/lintian-overrides create mode 100644 python-scipy.spec diff --git a/.gitignore b/.gitignore index a5def9428a6f..00073eaecd5f 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,5 @@ scipy/optimize/_group_columns.c scipy/optimize/cython_optimize/_zeros.c scipy/optimize/cython_optimize/_zeros.pyx scipy/optimize/lbfgsb/_lbfgsbmodule.c + +.pybuild/ diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 000000000000..a93e0a95a167 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,6 @@ +*.substvars +*debhelper* +.debhelper +files +python3-scipy +tmp diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000000..f28ed04acdfa --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +python-scipy (100:1.5.4-1) UNRELEASED; urgency=medium + + * https://github.com/scipy/scipy/releases/tag/v1.5.4 + + -- Wong Hoi Sing Edison Sun, 24 Dec 2023 12:34:50 +0800 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000000..139e9a82ce0f --- /dev/null +++ b/debian/control @@ -0,0 +1,47 @@ +Source: python-scipy +Section: python +Priority: optional +Standards-Version: 4.5.0 +Maintainer: Wong Hoi Sing Edison +Homepage: https://github.com/scipy/scipy/tags +Vcs-Browser: https://github.com/alvistack/scipy-scipy +Vcs-Git: https://github.com/alvistack/scipy-scipy.git +Build-Depends: + debhelper, + debhelper-compat (= 10), + dh-python, + cython3 (>= 0.29.18), + cython3 (<< 3.0.0), + fdupes, + gfortran, + liblapack-dev, + liblbfgsb-dev, + libopenblas-dev, + libsuitesparse-dev, + python3-decorator, + python3-dev, + python3-numpy (>= 1.14.5), + python3-pybind11 (>= 2.4.3), + python3-setuptools, + +Package: python3-scipy +Architecture: amd64 +Description: Scientific Library for Python + SciPy (pronounced "Sigh Pie") is open-source software for mathematics, + science, and engineering. The SciPy library depends on NumPy, which + provides convenient and fast N-dimensional array manipulation. The SciPy + library is built to work with NumPy arrays, and provides many + user-friendly and efficient numerical routines such as routines for + numerical integration and optimization. Together, they run on all + popular operating systems, are quick to install, and are free of charge. + NumPy and SciPy are easy to use, but powerful enough to be depended upon + by some of the world’s leading scientists and engineers. If you need to + manipulate numbers on a computer and display or publish the results, + give SciPy a try! +Depends: + ${misc:Depends}, + ${python3:Depends}, + ${shlibs:Depends}, + python3, + python3-decorator, + python3-numpy (>= 1.14.5), diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000000..dcb9a2448599 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: debian/* +Copyright: 2023 Wong Hoi Sing Edison +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + The complete text of the Apache version 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/debian/python3-scipy.install b/debian/python3-scipy.install new file mode 100644 index 000000000000..e3da3e75536a --- /dev/null +++ b/debian/python3-scipy.install @@ -0,0 +1 @@ +usr/lib/python*/*-packages/* diff --git a/debian/python3-scipy.lintian-overrides b/debian/python3-scipy.lintian-overrides new file mode 100644 index 000000000000..d51431fb0117 --- /dev/null +++ b/debian/python3-scipy.lintian-overrides @@ -0,0 +1,4 @@ +python3-scipy: copyright-without-copyright-notice +python3-scipy: initial-upload-closes-no-bugs +python3-scipy: no-manual-page +python3-scipy: zero-byte-file-in-doc-directory diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000000..fcaa45efe1f3 --- /dev/null +++ b/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +SHELL := /bin/bash + +override_dh_auto_install: + dh_auto_install --destdir=debian/tmp + find debian/tmp/usr/lib/python*/*-packages -type f -name '*.pyc' -exec rm -rf {} \; + fdupes -qnrps debian/tmp/usr/lib/python*/*-packages + +override_dh_auto_test: + +override_dh_auto_clean: + +%: + dh $@ --buildsystem=pybuild --with python3 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000000..163aaf8d82b6 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 000000000000..ce713bf22910 --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,5 @@ +python-scipy source: file-without-copyright-information +python-scipy source: no-debian-changes +python-scipy source: source-contains-prebuilt-windows-binary +python-scipy source: source-is-missing +python-scipy source: source-package-encodes-python-version diff --git a/python-scipy.spec b/python-scipy.spec new file mode 100644 index 000000000000..4b650f1281f2 --- /dev/null +++ b/python-scipy.spec @@ -0,0 +1,130 @@ +# Copyright 2023 Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +%global debug_package %{nil} + +Name: python-scipy +Epoch: 100 +Version: 1.5.4 +Release: 1%{?dist} +Summary: Scientific Library for Python +License: BSD-3-Clause +URL: https://github.com/scipy/scipy/tags +Source0: %{name}_%{version}.orig.tar.gz +BuildRequires: fdupes +BuildRequires: gcc-gfortran +BuildRequires: lapack-devel +BuildRequires: openblas-devel +BuildRequires: pybind11-devel >= 2.4.3 +BuildRequires: python-rpm-macros +BuildRequires: python3-cython >= 0.29.18 +BuildRequires: python3-cython < 3.0.0 +BuildRequires: python3-decorator +BuildRequires: python3-devel +BuildRequires: python3-numpy >= 1.14.5 +BuildRequires: python3-numpy-f2py >= 1.14.5 +BuildRequires: python3-pybind11 >= 2.4.3 +BuildRequires: python3-setuptools +BuildRequires: suitesparse-devel + +%description +SciPy (pronounced "Sigh Pie") is open-source software for mathematics, +science, and engineering. The SciPy library depends on NumPy, which +provides convenient and fast N-dimensional array manipulation. The SciPy +library is built to work with NumPy arrays, and provides many +user-friendly and efficient numerical routines such as routines for +numerical integration and optimization. Together, they run on all +popular operating systems, are quick to install, and are free of charge. +NumPy and SciPy are easy to use, but powerful enough to be depended upon +by some of the world’s leading scientists and engineers. If you need to +manipulate numbers on a computer and display or publish the results, +give SciPy a try! + +%prep +%autosetup -T -c -n %{name}_%{version}-%{release} +tar -zx -f %{S:0} --strip-components=1 -C . + +%build +%py3_build + +%install +%py3_install +find %{buildroot}%{python3_sitearch} -type f -name '*.pyc' -exec rm -rf {} \; +fdupes -qnrps %{buildroot}%{python3_sitearch} + +%check + +%if 0%{?suse_version} > 1500 +%package -n python%{python3_version_nodots}-scipy +Summary: Scientific Library for Python +Requires: python3 +Requires: python3-decorator +Requires: python3-numpy >= 1.14.5 +Provides: python3-scipy = %{epoch}:%{version}-%{release} +Provides: python3dist(scipy) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}-scipy = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}dist(scipy) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}-scipy = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}dist(scipy) = %{epoch}:%{version}-%{release} + +%description -n python%{python3_version_nodots}-scipy +SciPy (pronounced "Sigh Pie") is open-source software for mathematics, +science, and engineering. The SciPy library depends on NumPy, which +provides convenient and fast N-dimensional array manipulation. The SciPy +library is built to work with NumPy arrays, and provides many +user-friendly and efficient numerical routines such as routines for +numerical integration and optimization. Together, they run on all +popular operating systems, are quick to install, and are free of charge. +NumPy and SciPy are easy to use, but powerful enough to be depended upon +by some of the world’s leading scientists and engineers. If you need to +manipulate numbers on a computer and display or publish the results, +give SciPy a try! + +%files -n python%{python3_version_nodots}-scipy +%license LICENSE.txt +%{python3_sitearch}/* +%endif + +%if !(0%{?suse_version} > 1500) +%package -n python3-scipy +Summary: Scientific Library for Python +Requires: python3 +Requires: python3-decorator +Requires: python3-numpy >= 1.14.5 +Provides: python3-scipy = %{epoch}:%{version}-%{release} +Provides: python3dist(scipy) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}-scipy = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}dist(scipy) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}-scipy = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}dist(scipy) = %{epoch}:%{version}-%{release} + +%description -n python3-scipy +SciPy (pronounced "Sigh Pie") is open-source software for mathematics, +science, and engineering. The SciPy library depends on NumPy, which +provides convenient and fast N-dimensional array manipulation. The SciPy +library is built to work with NumPy arrays, and provides many +user-friendly and efficient numerical routines such as routines for +numerical integration and optimization. Together, they run on all +popular operating systems, are quick to install, and are free of charge. +NumPy and SciPy are easy to use, but powerful enough to be depended upon +by some of the world’s leading scientists and engineers. If you need to +manipulate numbers on a computer and display or publish the results, +give SciPy a try! + +%files -n python3-scipy +%license LICENSE.txt +%{python3_sitearch}/* +%endif + +%changelog diff --git a/scipy/stats/_stats.pyx b/scipy/stats/_stats.pyx index d331c1a201b6..cf773eac1afe 100644 --- a/scipy/stats/_stats.pyx +++ b/scipy/stats/_stats.pyx @@ -171,6 +171,11 @@ def _toint64(x): @cython.wraparound(False) @cython.boundscheck(False) def _weightedrankedtau(ordered[:] x, ordered[:] y, intp_t[:] rank, weigher, bool additive): + # y_local and rank_local (declared below) are a work-around for a Cython + # bug; see gh-16718. When we can require Cython 3.0, y_local and + # rank_local can be removed, and the closure weigh() can refer directly + # to y and rank. + cdef ordered[:] y_local = y cdef intp_t i, first cdef float64_t t, u, v, w, s, sq cdef int64_t n = np.int64(len(x)) @@ -189,6 +194,8 @@ def _weightedrankedtau(ordered[:] x, ordered[:] y, intp_t[:] rank, weigher, bool rank[...] = perm[::-1] _invert_in_place(rank) + cdef intp_t[:] rank_local = rank + # weigh joint ties first = 0 t = 0 @@ -237,28 +244,28 @@ def _weightedrankedtau(ordered[:] x, ordered[:] y, intp_t[:] rank, weigher, bool cdef float64_t weight, residual if length == 1: - return weigher(rank[perm[offset]]) + return weigher(rank_local[perm[offset]]) length0 = length // 2 length1 = length - length0 middle = offset + length0 residual = weigh(offset, length0) weight = weigh(middle, length1) + residual - if y[perm[middle - 1]] < y[perm[middle]]: + if y_local[perm[middle - 1]] < y_local[perm[middle]]: return weight # merging i = j = k = 0 while j < length0 and k < length1: - if y[perm[offset + j]] <= y[perm[middle + k]]: + if y_local[perm[offset + j]] <= y_local[perm[middle + k]]: temp[i] = perm[offset + j] - residual -= weigher(rank[temp[i]]) + residual -= weigher(rank_local[temp[i]]) j += 1 else: temp[i] = perm[middle + k] - exchanges_weight[0] += weigher(rank[temp[i]]) * ( + exchanges_weight[0] += weigher(rank_local[temp[i]]) * ( length0 - j) + residual if additive else weigher( - rank[temp[i]]) * residual + rank_local[temp[i]]) * residual k += 1 i += 1