1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
8 inherit distutils-r1 flag-o-matic
10 MYPN="${PN/scikits_/scikit-}"
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"
19 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
22 # tried to unbundle virtual/python-funcsigs, funcsigs, odict
23 # but it is a large mess to maintain
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}]
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}]
46 PATCHES=( "${FILESDIR}"/${PN}-0.18.1-system-cblas.patch )
48 python_prepare_all() {
50 [[ ${CHOST} == *-darwin* ]] \
51 && append-ldflags -bundle "-undefined dynamic_lookup" \
52 || append-ldflags -shared
54 # scikits-learn now uses the horrible numpy.distutils automagic
55 export SCIPY_FCONFIG="config_fc --noopt --noarch"
57 # remove bundled cblas
58 rm -r sklearn/src || die
60 # commented out, since it is a mess to maintain
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
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
75 distutils-r1_python_prepare_all
79 distutils-r1_python_compile ${SCIPY_FCONFIG}
83 # doc builds and runs tests
85 distutils_install_for_testing ${SCIPY_FCONFIG}
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
95 distutils-r1_python_install ${SCIPY_FCONFIG}
98 python_install_all() {
99 find "${S}" -name \*LICENSE.txt -delete
100 distutils-r1_python_install_all
101 if use examples; then
103 docompress -x /usr/share/doc/${PF}/examples