app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / sci-libs / scikits_learn / scikits_learn-0.19.0.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
7
8 inherit distutils-r1 flag-o-matic
9
10 MYPN="${PN/scikits_/scikit-}"
11 MYP="${MYPN}-${PV}"
12
13 DESCRIPTION="Python modules for machine learning and data mining"
14 HOMEPAGE="http://scikit-learn.org"
15 SRC_URI="mirror://pypi/${MYPN:0:1}/${MYPN}/${MYP}.tar.gz"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
20 IUSE="examples test"
21
22 # tried to unbundle virtual/python-funcsigs, funcsigs, odict
23 # but it is a large mess to maintain
24
25 RDEPEND="
26         dev-python/matplotlib[${PYTHON_USEDEP}]
27         dev-python/nose[${PYTHON_USEDEP}]
28         dev-python/numpy[lapack,${PYTHON_USEDEP}]
29         sci-libs/scikits[${PYTHON_USEDEP}]
30         sci-libs/scipy[${PYTHON_USEDEP}]
31         virtual/blas:=
32         virtual/cblas:=
33 "
34
35 DEPEND="
36         dev-python/cython[${PYTHON_USEDEP}]
37         dev-python/numpy[lapack,${PYTHON_USEDEP}]
38         dev-python/setuptools[${PYTHON_USEDEP}]
39         sci-libs/scipy[${PYTHON_USEDEP}]
40         virtual/blas:=
41         virtual/cblas:=
42 "
43
44 S="${WORKDIR}/${MYP}"
45
46 PATCHES=( "${FILESDIR}"/${PN}-0.18.1-system-cblas.patch )
47
48 python_prepare_all() {
49         # bug #397605
50         [[ ${CHOST} == *-darwin* ]] \
51                 && append-ldflags -bundle "-undefined dynamic_lookup" \
52                 || append-ldflags -shared
53
54         # scikits-learn now uses the horrible numpy.distutils automagic
55         export SCIPY_FCONFIG="config_fc --noopt --noarch"
56
57         # remove bundled cblas
58         rm -r sklearn/src || die
59
60         # commented out, since it is a mess to maintain
61         # use system joblib
62         #rm -r sklearn/externals/joblib || die
63         #sed -i -e '/joblib/d' sklearn/externals/setup.py || die
64         #for f in sklearn/{*/,}*.py; do
65         #       sed -r -e '/^from/s/(sklearn|\.|)\.externals\.joblib/joblib/' \
66         #               -e 's/from (sklearn|\.|)\.externals import/import/' -i $f || die
67         #done
68
69         # use system funcsigs and odict
70         #rm sklearn/externals/funcsigs.py || die
71         #rm sklearn/externals/odict.py || die
72         #for f in sklearn/{utils/fixes.py,gaussian_process/{tests/test_,}kernels.py}; do
73         #       sed -r -e 's/from (sklearn|\.|)\.externals\.funcsigs/from funcsigs/' -i $f || die
74         #done
75         distutils-r1_python_prepare_all
76 }
77
78 python_compile() {
79         distutils-r1_python_compile ${SCIPY_FCONFIG}
80 }
81
82 python_test() {
83         # doc builds and runs tests
84         use doc && return
85         distutils_install_for_testing ${SCIPY_FCONFIG}
86         esetup.py install \
87                           --root="${T}/test-${EPYTHON}" \
88                           --no-compile ${SCIPY_FCONFIG}
89         pushd "${T}/test-${EPYTHON}/$(python_get_sitedir)" || die > /dev/null
90         JOBLIB_MULTIPROCESSING=2 SKLEARN_SKIP_NETWORK_TESTS=1 nosetests -v sklearn --exe || die
91         popd > /dev/null
92 }
93
94 python_install() {
95         distutils-r1_python_install ${SCIPY_FCONFIG}
96 }
97
98 python_install_all() {
99         find "${S}" -name \*LICENSE.txt -delete
100         distutils-r1_python_install_all
101         if use examples; then
102                 dodoc -r examples
103                 docompress -x /usr/share/doc/${PF}/examples
104         fi
105
106 }