Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 3/7] dev-python/scipy: Pass -Dblas, -Dlapack via DISTUTILS_ARGS
Date: Fri, 25 Nov 2022 17:06:27
Message-Id: 20221125170508.23064-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/7] distutils-r1.eclass: mesonpy option passing support + periodic cleanup by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 dev-python/scipy/scipy-1.9.3-r1.ebuild | 109 +++++++++++++++++++++++++
4 dev-python/scipy/scipy-1.9.9999.ebuild | 11 ++-
5 2 files changed, 114 insertions(+), 6 deletions(-)
6 create mode 100644 dev-python/scipy/scipy-1.9.3-r1.ebuild
7
8 diff --git a/dev-python/scipy/scipy-1.9.3-r1.ebuild b/dev-python/scipy/scipy-1.9.3-r1.ebuild
9 new file mode 100644
10 index 000000000000..7c62ef8bb35f
11 --- /dev/null
12 +++ b/dev-python/scipy/scipy-1.9.3-r1.ebuild
13 @@ -0,0 +1,109 @@
14 +# Copyright 1999-2022 Gentoo Authors
15 +# Distributed under the terms of the GNU General Public License v2
16 +
17 +EAPI=8
18 +
19 +FORTRAN_NEEDED=fortran
20 +DISTUTILS_USE_PEP517=meson-python
21 +PYTHON_COMPAT=( python3_{8..11} )
22 +PYTHON_REQ_USE="threads(+)"
23 +
24 +inherit fortran-2 distutils-r1 multiprocessing
25 +
26 +DESCRIPTION="Scientific algorithms library for Python"
27 +HOMEPAGE="
28 + https://scipy.org/
29 + https://github.com/scipy/scipy/
30 + https://pypi.org/project/scipy/
31 +"
32 +
33 +if [[ ${PV} == *9999* ]] ; then
34 + inherit git-r3
35 +
36 + # Need submodules, so git for now.
37 + EGIT_REPO_URI="https://github.com/scipy/scipy"
38 + EGIT_BRANCH="maintenance/$(ver_cut 1-2).x"
39 + EGIT_SUBMODULES=( '*' )
40 +else
41 + # Upstream is often behind with doc updates
42 + DOC_PV=1.8.1
43 + MY_PV=${PV/_rc/rc}
44 + MY_P=${PN}-${MY_PV}
45 +
46 + SRC_URI="
47 + mirror://pypi/${PN:0:1}/${PN}/${MY_P}.tar.gz
48 + doc? (
49 + https://docs.scipy.org/doc/${PN}-${DOC_PV}/${PN}-html-${DOC_PV}.zip
50 + https://docs.scipy.org/doc/${PN}-${DOC_PV}/${PN}-ref-${DOC_PV}.pdf
51 + )"
52 + S="${WORKDIR}"/${MY_P}
53 +
54 + if [[ ${PV} != *rc* ]] ; then
55 + KEYWORDS="~amd64 ~arm ~arm64 -hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
56 + fi
57 +fi
58 +
59 +LICENSE="BSD LGPL-2"
60 +SLOT="0"
61 +IUSE="doc +fortran"
62 +
63 +# umfpack is technically optional but it's preferred to have it available.
64 +DEPEND="
65 + >=dev-python/numpy-1.18.5[lapack,${PYTHON_USEDEP}]
66 + sci-libs/arpack:=
67 + sci-libs/umfpack
68 + virtual/cblas
69 + >=virtual/lapack-3.8
70 +"
71 +RDEPEND="
72 + ${DEPEND}
73 + dev-python/pillow[${PYTHON_USEDEP}]
74 +"
75 +BDEPEND="
76 + dev-lang/swig
77 + >=dev-python/cython-0.29.18[${PYTHON_USEDEP}]
78 + >=dev-python/meson-python-0.11[${PYTHON_USEDEP}]
79 + dev-python/pybind11[${PYTHON_USEDEP}]
80 + >=dev-util/meson-0.62.2
81 + dev-util/patchelf
82 + virtual/pkgconfig
83 + doc? ( app-arch/unzip )
84 + fortran? ( dev-python/pythran[${PYTHON_USEDEP}] )
85 + test? ( dev-python/pytest-xdist[${PYTHON_USEDEP}] )"
86 +
87 +EPYTEST_DESELECT=(
88 + linalg/tests/test_decomp.py::TestSchur::test_sort
89 + linalg/tests/test_solvers.py::test_solve_discrete_are
90 +)
91 +
92 +distutils_enable_tests pytest
93 +
94 +src_unpack() {
95 + default
96 +
97 + if use doc; then
98 + unzip -qo "${DISTDIR}"/${PN}-html-${DOC_PV}.zip -d html || die
99 + fi
100 +}
101 +
102 +python_configure_all() {
103 + export SCIPY_USE_PYTHRAN=$(usex fortran 1 0)
104 + DISTUTILS_ARGS=(
105 + -Dblas=blas
106 + -Dlapack=lapack
107 + )
108 +}
109 +
110 +python_test() {
111 + cd "${T}" || die
112 +
113 + epytest -n "$(makeopts_jobs)" --pyargs scipy
114 +}
115 +
116 +python_install_all() {
117 + use doc && \
118 + local DOCS=( "${DISTDIR}"/${PN}-ref-${DOC_PV}.pdf ) \
119 + local HTML_DOCS=( "${WORKDIR}"/html/. )
120 +
121 + distutils-r1_python_install_all
122 +}
123 diff --git a/dev-python/scipy/scipy-1.9.9999.ebuild b/dev-python/scipy/scipy-1.9.9999.ebuild
124 index 6396c461e4e3..b85e9495ebc9 100644
125 --- a/dev-python/scipy/scipy-1.9.9999.ebuild
126 +++ b/dev-python/scipy/scipy-1.9.9999.ebuild
127 @@ -62,6 +62,7 @@ RDEPEND="
128 BDEPEND="
129 dev-lang/swig
130 >=dev-python/cython-0.29.18[${PYTHON_USEDEP}]
131 + >=dev-python/meson-python-0.11[${PYTHON_USEDEP}]
132 dev-python/pybind11[${PYTHON_USEDEP}]
133 >=dev-util/meson-0.62.2
134 dev-util/patchelf
135 @@ -70,10 +71,6 @@ BDEPEND="
136 fortran? ( dev-python/pythran[${PYTHON_USEDEP}] )
137 test? ( dev-python/pytest-xdist[${PYTHON_USEDEP}] )"
138
139 -PATCHES=(
140 - "${FILESDIR}"/${PN}-1.9.9999-meson-options-lapack.patch
141 -)
142 -
143 EPYTEST_DESELECT=(
144 linalg/tests/test_decomp.py::TestSchur::test_sort
145 linalg/tests/test_solvers.py::test_solve_discrete_are
146 @@ -90,9 +87,11 @@ src_unpack() {
147 }
148
149 python_configure_all() {
150 - # workaround stupid numpy distutils overrides, indirectly via pythran
151 - export SETUPTOOLS_USE_DISTUTILS=stdlib
152 export SCIPY_USE_PYTHRAN=$(usex fortran 1 0)
153 + DISTUTILS_ARGS=(
154 + -Dblas=blas
155 + -Dlapack=lapack
156 + )
157 }
158
159 python_test() {
160 --
161 2.38.1