Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/scipy/
Date: Thu, 19 May 2022 03:01:22
Message-Id: 1652929267.1e9653dd0688577b64da7071962cce1c76abc8c5.sam@gentoo
1 commit: 1e9653dd0688577b64da7071962cce1c76abc8c5
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 19 03:01:07 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu May 19 03:01:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e9653dd
7
8 dev-python/scipy: add 1.8.1
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 dev-python/scipy/Manifest | 3 +
13 dev-python/scipy/scipy-1.8.1.ebuild | 189 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 192 insertions(+)
15
16 diff --git a/dev-python/scipy/Manifest b/dev-python/scipy/Manifest
17 index d49ac5272be8..76487212a3c9 100644
18 --- a/dev-python/scipy/Manifest
19 +++ b/dev-python/scipy/Manifest
20 @@ -1,3 +1,6 @@
21 DIST scipy-1.8.0.tar.gz 38313602 BLAKE2B 3f071ad3dfa350bba7eaf8e06c8bdb660f9dc1ef0e0bfc1eb1be2c400f947b2b26d62066a4b0f603ae56244131aff6e4c5b7e87cfd2aa7b278e3071062a4bf02 SHA512 674652728ae76479d17189e6974895bb838a8e83b17b9fb91c5f86faebf2a1387e1466555ac5b51d05c293f9b31b9a72e634f5858105ea984ca94bd2f05bbb4c
22 +DIST scipy-1.8.1.tar.gz 38196215 BLAKE2B 180ae646adba2031a4bf99cd4feefe652b8e340110b3b2872e61aa1083054aadf369c7e3b3e3fd8fb71fcd831c95841d2dadd1c71e35e5f7d95800e5551173f0 SHA512 f6fc71c209991fe82baa4b10d8ade0deb1057f6f5942a91dfb7ae45f3eb78a4535efa2861badf5e2d37239fa99dbd99de760aa7e4854b95991ade0263004e7ea
23 DIST scipy-html-1.7.1.zip 32435246 BLAKE2B fd8173da41aba95a14b1376f848bc668c4659bf1bbbdd0f87d926633d36f29c039957d38be145a5583010ebd83f6458090f75bdad773cc0f1591664e13c04c20 SHA512 ee59722878f6ef2d2319cdf4e6a60d3d1184f7c22752f9a8859eaa46fb677ebac9e8eef9c0826998e12bac9399e336799843341ef203224a82c9101347149672
24 +DIST scipy-html-1.8.1.zip 37060661 BLAKE2B 2fa617c58eb47463f8a61f9798b32c6da255d26b8e86c1558e427a715093f5a29ced3847ab6ecfe88ce1017664f36ac3e9fa9bbf72ede7e0fd3812b5f41fe933 SHA512 95153dc1f404aa64898a700c94c0deea3ca842c3152167d0987edabcf4a8eba16b6c8e6bc38a6775a849dc621e6a21434baf53d1669b1865fa5049cffa4387ac
25 DIST scipy-ref-1.7.1.pdf 33542025 BLAKE2B 6c978f06b770805f0fae06db740e8596658d98bbbc93c865127eae909957503bb38e02a9c97319aed07608718f8f373374b1cf3a8c3bd624aa3143f1d21bc428 SHA512 45720dc299594bac5c7539f950a0ff135b125d86bfe9847032cbff1f294601fefd0a1ac3fd7e3928b2702390c318ae2f8adca6403ba06ea1ded705fcff94ab79
26 +DIST scipy-ref-1.8.1.pdf 35025868 BLAKE2B 9221755d2dc69b8623271f75ff3078a0a4410fe9ff69ee317b40bf145af7da21a7f5f4b6b67820d8bb2878f83b7014f1ea7c2f0e026afb716da0479d394505e2 SHA512 8f27dcb9dd1030e15266389af21a1475ecfec5ea777fb2dbcf8db8d3398ac6e45c7040b8d6dbaffd29be3920925427be7c55efdc8094d670c857edfdab7f7728
27
28 diff --git a/dev-python/scipy/scipy-1.8.1.ebuild b/dev-python/scipy/scipy-1.8.1.ebuild
29 new file mode 100644
30 index 000000000000..81edc28b8dca
31 --- /dev/null
32 +++ b/dev-python/scipy/scipy-1.8.1.ebuild
33 @@ -0,0 +1,189 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +DISTUTILS_IN_SOURCE_BUILD=1
40 +PYTHON_COMPAT=( python3_{8..10} )
41 +PYTHON_REQ_USE="threads(+)"
42 +
43 +inherit fortran-2 distutils-r1 flag-o-matic multiprocessing toolchain-funcs
44 +
45 +# Upstream is often behind with doc updates
46 +DOC_PV=1.8.1
47 +DESCRIPTION="Scientific algorithms library for Python"
48 +HOMEPAGE="
49 + https://scipy.org/
50 + https://github.com/scipy/scipy/
51 + https://pypi.org/project/scipy/
52 +"
53 +SRC_URI="
54 + mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
55 + doc? (
56 + https://docs.scipy.org/doc/${PN}-${DOC_PV}/${PN}-html-${DOC_PV}.zip
57 + https://docs.scipy.org/doc/${PN}-${DOC_PV}/${PN}-ref-${DOC_PV}.pdf
58 + )"
59 +
60 +LICENSE="BSD LGPL-2"
61 +SLOT="0"
62 +KEYWORDS="~amd64 ~arm ~arm64 -hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
63 +IUSE="doc +pythran sparse"
64 +
65 +DEPEND="
66 + >=dev-python/numpy-1.17.3[lapack,${PYTHON_USEDEP}]
67 + sci-libs/arpack:0=
68 + virtual/cblas
69 + virtual/lapack
70 + sparse? ( sci-libs/umfpack:0= )"
71 +RDEPEND="${DEPEND}
72 + dev-python/pillow[${PYTHON_USEDEP}]"
73 +BDEPEND="
74 + dev-lang/swig
75 + >=dev-python/cython-0.29.18[${PYTHON_USEDEP}]
76 + dev-python/pybind11[${PYTHON_USEDEP}]
77 + virtual/pkgconfig
78 + doc? ( app-arch/unzip )
79 + pythran? ( dev-python/pythran[${PYTHON_USEDEP}] )
80 + test? (
81 + dev-python/nose[${PYTHON_USEDEP}]
82 + dev-python/pytest-xdist[${PYTHON_USEDEP}]
83 + )"
84 +
85 +distutils_enable_tests pytest
86 +
87 +src_unpack() {
88 + default
89 +
90 + if use doc; then
91 + unzip -qo "${DISTDIR}"/${PN}-html-${DOC_PV}.zip -d html || die
92 + fi
93 +}
94 +
95 +pc_incdir() {
96 + $(tc-getPKG_CONFIG) --cflags-only-I $@ | \
97 + sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e 's|^:||'
98 +}
99 +
100 +pc_libdir() {
101 + $(tc-getPKG_CONFIG) --libs-only-L $@ | \
102 + sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e 's|^:||'
103 +}
104 +
105 +pc_libs() {
106 + $(tc-getPKG_CONFIG) --libs-only-l $@ | \
107 + sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \
108 + -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \
109 + | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||'
110 +}
111 +
112 +python_prepare_all() {
113 + # scipy automatically detects libraries by default
114 + export {FFTW,FFTW3,UMFPACK}=None
115 + use sparse && unset UMFPACK
116 +
117 + # the missing symbols are in -lpythonX.Y, but since the version can
118 + # differ, we just introduce the same scaryness as on Linux/ELF
119 + [[ ${CHOST} == *-darwin* ]] \
120 + && append-ldflags -bundle "-undefined dynamic_lookup" \
121 + || append-ldflags -shared
122 +
123 + [[ -z ${FC} ]] && export FC="$(tc-getFC)"
124 + # hack to force F77 to be FC until bug #278772 is fixed
125 + [[ -z ${F77} ]] && export F77="$(tc-getFC)"
126 + export F90="${FC}"
127 + export SCIPY_FCONFIG="config_fc --noopt --noarch"
128 + append-fflags -fPIC
129 +
130 + local libdir="${EPREFIX}"/usr/$(get_libdir)
131 + cat >> site.cfg <<-EOF || die
132 + [blas]
133 + include_dirs = $(pc_incdir cblas)
134 + library_dirs = $(pc_libdir cblas blas):${libdir}
135 + blas_libs = $(pc_libs cblas blas)
136 + [lapack]
137 + library_dirs = $(pc_libdir lapack):${libdir}
138 + lapack_libs = $(pc_libs lapack)
139 + EOF
140 + cat >> setup.cfg <<-EOF || die
141 + [options]
142 + zip_safe = False
143 + EOF
144 +
145 + # TODO
146 + sed -e "s:== 'levy_stable':in ('levy_stable', 'crystalball', 'ncf'):" \
147 + -i scipy/stats/tests/test_continuous_basic.py || die
148 +
149 + # Skip known-failing test. Broken on all versions in Gentoo for years.
150 + # bug #743295
151 + sed -e 's:test_bisplev_integer_overflow:_&:' \
152 + -i scipy/interpolate/tests/test_fitpack.py || die
153 +
154 + # Skip a few 32-bit related failures
155 + if use x86 ; then
156 + # TODO: Tidy this up and switch to epytest
157 + sed -i -e 's:test_nd_axis_m1:_&:' \
158 + -e 's:test_nd_axis_0:_&:' \
159 + -e 's:test_maxiter_worsening:_&:' \
160 + -e 's:test_pdist_jensenshannon_iris:_&:' \
161 + -e 's:test_align_vectors_single_vector:_&:' \
162 + scipy/signal/tests/test_spectral.py \
163 + scipy/spatial/tests/test_distance.py \
164 + scipy/spatial/transform/tests/test_rotation.py || die
165 + fi
166 +
167 + if has_version ">=sci-libs/lapack-3.10"; then
168 + sed -e 's:test_sort(:_&:' \
169 + -i scipy/linalg/tests/test_decomp.py || die
170 + sed -e 's:test_solve_discrete_are:_&:' \
171 + -i scipy/linalg/tests/test_solvers.py || die
172 + fi
173 +
174 + distutils-r1_python_prepare_all
175 +}
176 +
177 +python_configure_all() {
178 + export SCIPY_USE_PYTHRAN=$(usex pythran 1 0)
179 +
180 + # bug 721860
181 + test-flag-FC -fallow-argument-mismatch &&
182 + append-fflags -fallow-argument-mismatch
183 +}
184 +
185 +python_compile() {
186 + # FIXME: parallel python building fails, bug #614464
187 + export ORIGINAL_MAKEOPTS="${MAKEOPTS}"
188 + export MAKEOPTS=-j1
189 +
190 + ${EPYTHON} tools/cythonize.py || die
191 + distutils-r1_python_compile \
192 + ${SCIPY_FCONFIG}
193 +}
194 +
195 +python_test() {
196 + # fails with bdist_egg. should it be fixed in distutils-r1 eclass?
197 + distutils_install_for_testing ${SCIPY_FCONFIG}
198 + cd "${TEST_DIR}/lib" || die "no ${TEST_DIR} available"
199 +
200 + # Let's try using pytest again with xdist to speed things up.
201 + # Note that using pytest is required to avoid dying b/c of a
202 + # deprecation warning with distutils in Python 3.01.
203 + epytest -n "$(makeopts_jobs "${ORIGINAL_MAKEOPTS}" "$(get_nproc)")"
204 +}
205 +
206 +python_install_all() {
207 + use doc && \
208 + local DOCS=( "${DISTDIR}"/${PN}-ref-${DOC_PV}.pdf ) \
209 + local HTML_DOCS=( "${WORKDIR}"/html/. )
210 + distutils-r1_python_install_all
211 +}
212 +
213 +python_install() {
214 + distutils-r1_python_install ${SCIPY_FCONFIG}
215 + python_optimize
216 +}
217 +
218 +pkg_postinst() {
219 + elog "You might want to set the variable SCIPY_PIL_IMAGE_VIEWER"
220 + elog "to your prefered image viewer. Example:"
221 + elog " echo \"export SCIPY_PIL_IMAGE_VIEWER=display\" >> ~/.bashrc"
222 +}