Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/scipy-python2/
Date: Tue, 28 Jan 2020 21:30:33
Message-Id: 1580247009.0f29cb1a064d642e5d62882785e4772d78610dfc.mgorny@gentoo
1 commit: 0f29cb1a064d642e5d62882785e4772d78610dfc
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 28 20:46:05 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 28 21:30:09 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f29cb1a
7
8 sci-libs/scipy-python2: Split from scipy
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sci-libs/scipy-python2/Manifest | 1 +
13 sci-libs/scipy-python2/metadata.xml | 23 ++++
14 sci-libs/scipy-python2/scipy-python2-1.1.0.ebuild | 128 ++++++++++++++++++++++
15 3 files changed, 152 insertions(+)
16
17 diff --git a/sci-libs/scipy-python2/Manifest b/sci-libs/scipy-python2/Manifest
18 new file mode 100644
19 index 00000000000..e9452548014
20 --- /dev/null
21 +++ b/sci-libs/scipy-python2/Manifest
22 @@ -0,0 +1 @@
23 +DIST scipy-1.1.0.tar.gz 15583560 BLAKE2B 477753e622ee26a3bc8c2cb6829410152df84b29ce17a6d53a66348f5536f7993fedf5d32b782405b54b3af3feabf9bc91c381ed39546076849c2fdb71039404 SHA512 72fe32c6c009613cb78202598e5db14f8e630b3218839cfe18d43d40550d94cc5aa100c6f5d41f40e86ae148e9b6a13431bb91b0f9be44b0569ccd7b725fe973
24
25 diff --git a/sci-libs/scipy-python2/metadata.xml b/sci-libs/scipy-python2/metadata.xml
26 new file mode 100644
27 index 00000000000..2425e896a8a
28 --- /dev/null
29 +++ b/sci-libs/scipy-python2/metadata.xml
30 @@ -0,0 +1,23 @@
31 +<?xml version="1.0" encoding="UTF-8"?>
32 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
33 +<pkgmetadata>
34 + <maintainer type="project">
35 + <email>sci@g.o</email>
36 + <name>Gentoo Science Project</name>
37 + </maintainer>
38 + <longdescription lang="en">
39 + SciPy is an open source library of scientific tools for Python. SciPy
40 + supplements the popular numpy module, gathering a variety of high level
41 + science and engineering modules together as a single package.
42 + SciPy includes modules for graphics and plotting, optimization,
43 + integration, special functions, signal and image processing, genetic
44 + algorithms, ODE solvers, and others.
45 + </longdescription>
46 + <use>
47 + <flag name="sparse">Adds support for sparse solving with <pkg>sci-libs/umfpack</pkg></flag>
48 + </use>
49 + <upstream>
50 + <remote-id type="pypi">scipy</remote-id>
51 + <remote-id type="sourceforge">scipy</remote-id>
52 + </upstream>
53 +</pkgmetadata>
54
55 diff --git a/sci-libs/scipy-python2/scipy-python2-1.1.0.ebuild b/sci-libs/scipy-python2/scipy-python2-1.1.0.ebuild
56 new file mode 100644
57 index 00000000000..23d6871c6c3
58 --- /dev/null
59 +++ b/sci-libs/scipy-python2/scipy-python2-1.1.0.ebuild
60 @@ -0,0 +1,128 @@
61 +# Copyright 1999-2020 Gentoo Authors
62 +# Distributed under the terms of the GNU General Public License v2
63 +
64 +EAPI=6
65 +
66 +PYTHON_COMPAT=( python2_7 )
67 +PYTHON_REQ_USE="threads(+)"
68 +
69 +inherit fortran-2 distutils-r1 flag-o-matic multiprocessing toolchain-funcs
70 +
71 +MY_PN=${PN/-python2}
72 +MY_P=${MY_PN}-${PV}
73 +
74 +DESCRIPTION="Scientific algorithms library for Python (py2 version)"
75 +HOMEPAGE="https://www.scipy.org/"
76 +SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
77 +S=${WORKDIR}/${MY_P}
78 +
79 +LICENSE="BSD LGPL-2"
80 +SLOT="0"
81 +IUSE="sparse test"
82 +RESTRICT="!test? ( test )"
83 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
84 +
85 +CDEPEND="
86 + || (
87 + >=dev-python/numpy-python2-1.10[lapack,${PYTHON_USEDEP}]
88 + >=dev-python/numpy-1.10[lapack,${PYTHON_USEDEP}]
89 + )
90 + sci-libs/arpack:0=
91 + virtual/cblas
92 + virtual/lapack
93 + sparse? ( sci-libs/umfpack:0= )"
94 +DEPEND="${CDEPEND}
95 + dev-lang/swig
96 + >=dev-python/cython-0.22[${PYTHON_USEDEP}]
97 + >=dev-python/setuptools-36[${PYTHON_USEDEP}]
98 + virtual/pkgconfig
99 + test? (
100 + dev-python/nose[${PYTHON_USEDEP}]
101 + dev-python/pytest[${PYTHON_USEDEP}]
102 + )"
103 +RDEPEND="${CDEPEND}
104 + !<sci-libs/scipy-1.4
105 + dev-python/pillow[${PYTHON_USEDEP}]"
106 +
107 +DOCS=( HACKING.rst.txt THANKS.txt )
108 +
109 +DISTUTILS_IN_SOURCE_BUILD=1
110 +
111 +pc_incdir() {
112 + $(tc-getPKG_CONFIG) --cflags-only-I $@ | \
113 + sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e 's|^:||'
114 +}
115 +
116 +pc_libdir() {
117 + $(tc-getPKG_CONFIG) --libs-only-L $@ | \
118 + sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e 's|^:||'
119 +}
120 +
121 +pc_libs() {
122 + $(tc-getPKG_CONFIG) --libs-only-l $@ | \
123 + sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \
124 + -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \
125 + | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||'
126 +}
127 +
128 +python_prepare_all() {
129 + # scipy automatically detects libraries by default
130 + export {FFTW,FFTW3,UMFPACK}=None
131 + use sparse && unset UMFPACK
132 + # the missing symbols are in -lpythonX.Y, but since the version can
133 + # differ, we just introduce the same scaryness as on Linux/ELF
134 + [[ ${CHOST} == *-darwin* ]] \
135 + && append-ldflags -bundle "-undefined dynamic_lookup" \
136 + || append-ldflags -shared
137 + [[ -z ${FC} ]] && export FC="$(tc-getFC)"
138 + # hack to force F77 to be FC until bug #278772 is fixed
139 + [[ -z ${F77} ]] && export F77="$(tc-getFC)"
140 + export F90="${FC}"
141 + export SCIPY_FCONFIG="config_fc --noopt --noarch"
142 + append-fflags -fPIC
143 +
144 + local libdir="${EPREFIX}"/usr/$(get_libdir)
145 + cat >> site.cfg <<-EOF || die
146 + [blas]
147 + include_dirs = $(pc_incdir cblas)
148 + library_dirs = $(pc_libdir cblas blas):${libdir}
149 + blas_libs = $(pc_libs cblas blas)
150 + [lapack]
151 + library_dirs = $(pc_libdir lapack):${libdir}
152 + lapack_libs = $(pc_libs lapack)
153 + EOF
154 +
155 + # Drop hashes to force rebuild of cython based .c code
156 + rm cythonize.dat || die
157 +
158 + distutils-r1_python_prepare_all
159 +}
160 +
161 +python_compile() {
162 + # FIXME: parallel python building fails, bug #614464
163 + ${EPYTHON} tools/cythonize.py || die
164 + distutils-r1_python_compile \
165 + ${SCIPY_FCONFIG}
166 +}
167 +
168 +python_test() {
169 + # fails with bdist_egg. should it be fixed in distutils-r1 eclass?
170 + distutils_install_for_testing ${SCIPY_FCONFIG}
171 + cd "${TEST_DIR}" || die "no ${TEST_DIR} available"
172 + "${PYTHON}" -c \
173 + 'import numpy as np; print("relaxed strides checking:", np.ones((10,1),order="C").flags.f_contiguous)' \
174 + || die
175 + "${EPYTHON}" -c \
176 + "import scipy, sys; r = scipy.test('fast', verbose=2); sys.exit(r)" \
177 + || die "Tests fail with ${EPYTHON}"
178 +}
179 +
180 +python_install() {
181 + distutils-r1_python_install ${SCIPY_FCONFIG}
182 +}
183 +
184 +pkg_postinst() {
185 + elog "You might want to set the variable SCIPY_PIL_IMAGE_VIEWER"
186 + elog "to your prefered image viewer. Example:"
187 + elog "\t echo \"export SCIPY_PIL_IMAGE_VIEWER=display\" >> ~/.bashrc"
188 +}