diff options
author | Universebenzene | 2023-02-05 13:52:53 +0800 |
---|---|---|
committer | Universebenzene | 2023-02-05 13:52:53 +0800 |
commit | e6c33f424bfc06f6052a20e46b0283ea1fcfaed3 (patch) | |
tree | 5108f51c0a03dc361309cd087a43f23c37ff0e05 | |
parent | 3266fb07e2c40c68a24d1e07f2a93c1fb4624e18 (diff) | |
download | aur-e6c33f424bfc06f6052a20e46b0283ea1fcfaed3.tar.gz |
Update for numpy 1.24
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 16 | ||||
-rw-r--r-- | fix-collection-py3.10.patch | 24 | ||||
-rw-r--r-- | fix-compability-to-numpy-1.24.patch | 81 |
4 files changed, 107 insertions, 22 deletions
@@ -1,7 +1,7 @@ pkgbase = python-astrodendro pkgdesc = Python package for computation of astronomical dendrograms pkgver = 0.2.0 - pkgrel = 2 + pkgrel = 3 url = https://dendrograms.readthedocs.io arch = any license = MIT @@ -13,14 +13,16 @@ pkgbase = python-astrodendro makedepends = python-aplpy source = https://files.pythonhosted.org/packages/source/a/astrodendro/astrodendro-0.2.0.tar.gz source = fix-collection-py3.10.patch + source = fix-compability-to-numpy-1.24.patch source = new-doc-building.patch md5sums = 6f4155b1d4a4b2d9cb9ae154f88c5710 - md5sums = 1b5d8b8c5d0387a09b15c02fc1b40714 + md5sums = 85f81c440ce6d9f38fe0f3dd3166c911 + md5sums = 11ee36f5a91348ae6843da182d54299f md5sums = 2bd96deeaa18ae57c196246b74ee8030 pkgname = python-astrodendro depends = python - depends = python-numpy>=1.4.1 + depends = python-numpy>=1.24 depends = python-astropy>=0.2.0 depends = python-h5py>=0.2.0 optdepends = python-matplotlib: For plotting @@ -3,7 +3,7 @@ pkgbase=python-astrodendro _pyname=${pkgbase#python-} pkgname=("python-${_pyname}" "python-${_pyname}-doc") pkgver=0.2.0 -pkgrel=2 +pkgrel=3 pkgdesc="Python package for computation of astronomical dendrograms" arch=('any') url="https://dendrograms.readthedocs.io" @@ -19,15 +19,18 @@ checkdepends=('python-pytest' 'python-h5py') # 'python-astropy' 'python-matplotlib' source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz" 'fix-collection-py3.10.patch' + 'fix-compability-to-numpy-1.24.patch' 'new-doc-building.patch') md5sums=('6f4155b1d4a4b2d9cb9ae154f88c5710' - '1b5d8b8c5d0387a09b15c02fc1b40714' + '85f81c440ce6d9f38fe0f3dd3166c911' + '11ee36f5a91348ae6843da182d54299f' '2bd96deeaa18ae57c196246b74ee8030') prepare() { cd ${srcdir}/${_pyname}-${pkgver} patch -Np1 -i "${srcdir}/fix-collection-py3.10.patch" + patch -Np1 -i "${srcdir}/fix-compability-to-numpy-1.24.patch" patch -Np1 -i "${srcdir}/new-doc-building.patch" } @@ -37,19 +40,18 @@ build() { # python -m build --wheel --no-isolation msg "Building Docs" - cd ${srcdir}/${_pyname}-${pkgver}/docs -## python setup.py build_sphinx - PYTHONPATH="../build/lib" make html +# python setup.py build_sphinx + PYTHONPATH="../build/lib" make -C docs html } check() { cd ${srcdir}/${_pyname}-${pkgver} - pytest || warning "Tests failed" + pytest || warning "Tests failed" # -vv --color=yes } package_python-astrodendro() { - depends=('python' 'python-numpy>=1.4.1' 'python-astropy>=0.2.0' 'python-h5py>=0.2.0') + depends=('python' 'python-numpy>=1.24' 'python-astropy>=0.2.0' 'python-h5py>=0.2.0') optdepends=('python-matplotlib: For plotting' 'python-pytest: For testing' 'python-mock: For testing' diff --git a/fix-collection-py3.10.patch b/fix-collection-py3.10.patch index ac3a3738dab9..31d260b36f40 100644 --- a/fix-collection-py3.10.patch +++ b/fix-collection-py3.10.patch @@ -1,23 +1,23 @@ ---- a/astrodendro/dendrogram.py 2016-09-29 17:23:53.000000000 +0800 -+++ b/astrodendro/dendrogram.py 2022-08-22 16:14:19.114340172 +0800 +Description: Add try-except clause for importing Iterable pre/post Python 3.9. +Origin: https://github.com/dendrograms/astrodendro/commit/3fde58f1e06bf7f966ed52712d1bf8929282be41.patch +Author: nbrunett <nate.brunetti@gmail.com> +Date: Tue, 15 Feb 2022 13:55:09 -0500 +Last-Update: 2022-04-10 + + +--- a/astrodendro/dendrogram.py ++++ b/astrodendro/dendrogram.py @@ -5,7 +5,12 @@ # - An ancestor is the largest structure that a structure is part of import numpy as np -from collections import Iterable +try: -+ # Python > 3.9 -+ from collections.abc import Iterable -+except ImportError: + # Python <= 3.9 + from collections import Iterable ++except ImportError: ++ # Python > 3.9 ++ from collections.abc import Iterable import copy import warnings -@@ -847,4 +852,4 @@ - # To make the structure.level property fast, we ensure all the structures in the - # trunk have their level cached as "0" - for structure in dendrogram.trunk: -- structure._level = 0 # See the definition of level() in structure.py -\ No newline at end of file -+ structure._level = 0 # See the definition of level() in structure.py diff --git a/fix-compability-to-numpy-1.24.patch b/fix-compability-to-numpy-1.24.patch new file mode 100644 index 000000000000..ce4b34908494 --- /dev/null +++ b/fix-compability-to-numpy-1.24.patch @@ -0,0 +1,81 @@ +--- a/astrodendro/analysis.py 2016-09-29 17:23:53.000000000 +0800 ++++ b/astrodendro/analysis.py 2023-02-05 13:09:03.929960758 +0800 +@@ -77,7 +77,7 @@ + Location of each element of values. The i-th array in the tuple + describes the ith positional dimension + """ +- self.values = values.astype(np.float) ++ self.values = values.astype(float) + self.indices = indices + + @memoize +@@ -126,13 +126,13 @@ + The variance (or co-variance matrix) of the data along the + specified direction(s). + """ +- w = np.atleast_2d(direction).astype(np.float) ++ w = np.atleast_2d(direction).astype(float) + for row in w: + row /= np.linalg.norm(row) + + result = np.dot(np.dot(w, self.mom2()), w.T) + if result.size == 1: +- result = np.asscalar(result) ++ result = result.item() + return result + + @memoize +--- a/astrodendro/dendrogram.py 2023-02-05 13:10:42.786010635 +0800 ++++ b/astrodendro/dendrogram.py 2023-02-05 13:07:48.077121718 +0800 +@@ -27,7 +27,7 @@ + # utility dict to offsets of adjacent pixel list + _offsets = dict((ndim, np.concatenate(( + np.identity(ndim), +- np.identity(ndim) * -1)).astype(np.int)) ++ np.identity(ndim) * -1)).astype(int)) + for ndim in range(1, 8)) + + # the formula above generalizes this special case +@@ -655,11 +655,11 @@ + # index[offset[pi] : offset[pi] + npix[pi]] + # and including subtrees is + # index[offset[pi] : offset[pi] + npix_subtree[pi]] +- offset = np.zeros(idx_ct.size, dtype=np.int) ++ offset = np.zeros(idx_ct.size, dtype=int) + npix = offset * 0 + npix_subtree = offset * 0 + +- index = -np.ones(sz, dtype=np.int) ++ index = -np.ones(sz, dtype=int) + order = dendrogram.all_structures + + pos = 0 +@@ -852,4 +852,4 @@ + # To make the structure.level property fast, we ensure all the structures in the + # trunk have their level cached as "0" + for structure in dendrogram.trunk: +- structure._level = 0 # See the definition of level() in structure.py +\ 文件尾没有换行符 ++ structure._level = 0 # See the definition of level() in structure.py +--- a/astrodendro/pruning.py 2016-09-29 17:23:53.000000000 +0800 ++++ b/astrodendro/pruning.py 2023-02-05 13:07:48.077121718 +0800 +@@ -40,7 +40,7 @@ + else: # mode == 'wrap' + indices = [i % d for i, d in zip(indices, dims)] + +- result = np.zeros(len(multi_index[0]), dtype=np.int) ++ result = np.zeros(len(multi_index[0]), dtype=int) + offset = 1 + for i, d in list(zip(indices, dims))[::-1]: + result += (i * offset).ravel() +--- a/astrodendro/tests/test_compute.py 2016-09-29 17:23:53.000000000 +0800 ++++ b/astrodendro/tests/test_compute.py 2023-02-05 13:07:48.080455029 +0800 +@@ -110,7 +110,7 @@ + assert len(d.leaves) == 55
+
+ # Now check every pixel in the data cube (this takes a while).
+- st_map = -np.ones(self.data.shape, dtype=np.int)
++ st_map = -np.ones(self.data.shape, dtype=int)
+ for st in d.all_structures:
+ st_map[st.indices(subtree=False)] = st.idx
+
|