diff --git a/python-fastcluster.changes b/python-fastcluster.changes index 5c22163..cc7cd83 100644 --- a/python-fastcluster.changes +++ b/python-fastcluster.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jul 19 02:32:28 UTC 2024 - Steve Kowalik + +- Add patch support-numpy-2.patch: + * Support both numpy 1 and 2 +- Switch to pyproject macros. +- No more greedy globs in %files. + ------------------------------------------------------------------- Wed Sep 28 14:00:59 UTC 2022 - Arun Persaud diff --git a/python-fastcluster.spec b/python-fastcluster.spec index fd79ab8..7cbcab5 100644 --- a/python-fastcluster.spec +++ b/python-fastcluster.spec @@ -1,7 +1,7 @@ # # spec file for package python-fastcluster # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,22 +16,22 @@ # -%define skip_python2 1 -%define skip_python36 1 -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-fastcluster Version: 1.2.6 Release: 0 Summary: Hierarchical clustering routines for Python License: BSD-2-Clause -Group: Development/Languages/Python URL: https://github.com/dmuellner/fastcluster Source: https://files.pythonhosted.org/packages/source/f/fastcluster/fastcluster-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#fastcluster/fastcluster#94 +Patch0: support-numpy-2.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module numpy-devel >= 1.9} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module scipy} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: python-rpm-macros @@ -71,10 +71,10 @@ sed -i 's/\r$//' README.txt %build export CFLAGS="%{optflags}" -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitearch} %check @@ -84,7 +84,10 @@ export LANG=en_US.UTF-8 %files %{python_files} %license COPYING.txt %doc CITATION.txt NEWS.txt README.txt -%{python_sitearch}/* +%{python_sitearch}/fastcluster.py +%{python_sitearch}/_fastcluster.cpython-*.so +%pycache_only %{python_sitearch}/__pycache__/fastcluster.*.pyc +%{python_sitearch}/fastcluster-%{version}.dist-info %files -n %{name}-doc %doc docs/fastcluster.pdf diff --git a/support-numpy-2.patch b/support-numpy-2.patch new file mode 100644 index 0000000..682e905 --- /dev/null +++ b/support-numpy-2.patch @@ -0,0 +1,46 @@ +From 58cffa97fff38ca4dda3166b4ccb1a8eb27a124f Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Fri, 19 Jul 2024 12:21:11 +1000 +Subject: [PATCH] Support Numpy 2 + +Switch to using np.asarray() where required to support both Numpy 1 and +2. +--- + fastcluster.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fastcluster.py b/fastcluster.py +index f5325a6..8778605 100644 +--- a/fastcluster.py ++++ b/fastcluster.py +@@ -23,7 +23,7 @@ + __version_info__ = ('1', '2', '6') + __version__ = '.'.join(__version_info__) + +-from numpy import double, empty, array, ndarray, var, cov, dot, expand_dims, \ ++from numpy import double, empty, array, asarray, ndarray, var, cov, dot, expand_dims, \ + ceil, sqrt + from numpy.linalg import inv + try: +@@ -227,7 +227,7 @@ def linkage(X, method='single', metric='euclidean', preserve_input=True): + + The linkage method does not treat NumPy's masked arrays as special + and simply ignores the mask.''' +- X = array(X, copy=False, subok=True) ++ X = asarray(X) + if X.ndim==1: + if method=='single': + preserve_input = False +@@ -464,10 +464,10 @@ def linkage_vector(X, method='single', metric='euclidean', extraarg=None): + dtype = bool if X.dtype==bool else double + else: + dtype = bool if metric in booleanmetrics else double +- X = array(X, dtype=dtype, copy=False, order='C', subok=True) + else: + assert metric=='euclidean' +- X = array(X, dtype=double, copy=(method=='ward'), order='C', subok=True) ++ dtype = double ++ X = asarray(X, dtype=dtype, order='C') + assert X.ndim==2 + N = len(X) + Z = empty((N-1,4))