1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{6,7} )
7 PYTHON_REQ_USE='readline,sqlite,threads(+)'
9 inherit distutils-r1 eutils virtualx
11 DESCRIPTION="Advanced interactive shell for Python"
12 HOMEPAGE="http://ipython.org/"
13 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
17 KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
18 IUSE="doc examples matplotlib notebook nbconvert qt5 +smp test"
19 RESTRICT="!test? ( test )"
22 dev-python/backcall[${PYTHON_USEDEP}]
23 dev-python/decorator[${PYTHON_USEDEP}]
24 dev-python/jedi[${PYTHON_USEDEP}]
25 dev-python/pexpect[${PYTHON_USEDEP}]
26 dev-python/pickleshare[${PYTHON_USEDEP}]
27 >=dev-python/prompt_toolkit-2[${PYTHON_USEDEP}]
28 <dev-python/prompt_toolkit-2.1[${PYTHON_USEDEP}]
29 dev-python/pygments[${PYTHON_USEDEP}]
30 dev-python/traitlets[${PYTHON_USEDEP}]
31 matplotlib? ( dev-python/matplotlib[${PYTHON_USEDEP}] )
35 nbconvert? ( dev-python/nbconvert[${PYTHON_USEDEP}] )"
38 dev-python/setuptools[${PYTHON_USEDEP}]
40 >=dev-python/ipykernel-5.1.0[${PYTHON_USEDEP}]
41 dev-python/nbformat[${PYTHON_USEDEP}]
42 dev-python/nose[${PYTHON_USEDEP}]
43 dev-python/numpy[${PYTHON_USEDEP}]
44 dev-python/requests[${PYTHON_USEDEP}]
45 dev-python/testpath[${PYTHON_USEDEP}]
48 >=dev-python/ipykernel-5.1.0[${PYTHON_USEDEP}]
49 >=dev-python/sphinx-2[${PYTHON_USEDEP}]
54 dev-python/notebook[${PYTHON_USEDEP}]
55 dev-python/ipywidgets[${PYTHON_USEDEP}]
56 dev-python/widgetsnbextension[${PYTHON_USEDEP}]
58 qt5? ( dev-python/qtconsole[${PYTHON_USEDEP}] )
60 >=dev-python/ipykernel-5.1.0[${PYTHON_USEDEP}]
61 >=dev-python/ipyparallel-6.2.3[${PYTHON_USEDEP}]
64 PATCHES=( "${FILESDIR}"/2.1.0-substitute-files.patch )
66 DISTUTILS_IN_SOURCE_BUILD=1
68 python_prepare_all() {
69 # Remove out of date insource files
70 rm IPython/extensions/cythonmagic.py || die
71 rm IPython/extensions/rmagic.py || die
73 # Prevent un-needed download during build
75 sed -e "/^ 'sphinx.ext.intersphinx',/d" -i docs/source/conf.py || die
78 distutils-r1_python_prepare_all
81 python_compile_all() {
83 emake -C docs html_noapi
84 HTML_DOCS=( docs/build/html/. )
89 virtx distutils-r1_src_test
93 distutils_install_for_testing
94 pushd "${TEST_DIR}" >/dev/null || die
95 "${TEST_DIR}"/scripts/iptest || die
96 popd >/dev/null || die
100 distutils-r1_python_install
102 # Create ipythonX.Y symlinks.
104 # 1. do we want them for pypy? No. pypy has no numpy
105 # 2. handle it in the eclass instead (use _python_ln_rel).
106 # With pypy not an option the dosym becomes unconditional
107 dosym ../lib/python-exec/${EPYTHON}/ipython \
108 /usr/bin/ipython${EPYTHON#python}
111 python_install_all() {
112 distutils-r1_python_install_all
114 if use examples; then
116 docompress -x /usr/share/doc/${PF}/examples
121 optfeature "sympyprinting" dev-python/sympy
122 optfeature "cythonmagic" dev-python/cython
123 optfeature "%lprun magic command" dev-python/line_profiler
124 optfeature "%mprun magic command" dev-python/memory_profiler
126 if use nbconvert; then
127 if ! has_version app-text/pandoc ; then
128 einfo "Node.js will be used to convert notebooks to other formats"
129 einfo "like HTML. Support for that is still experimental. If you"
130 einfo "encounter any problems, please use app-text/pandoc instead."