*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / ipython / ipython-7.5.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7} )
7 PYTHON_REQ_USE='readline,sqlite,threads(+)'
8
9 inherit distutils-r1 eutils virtualx
10
11 DESCRIPTION="Advanced interactive shell for Python"
12 HOMEPAGE="http://ipython.org/"
13 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
14
15 LICENSE="BSD"
16 SLOT="0"
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 )"
20
21 CDEPEND="
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}] )
32 "
33
34 RDEPEND="${CDEPEND}
35         nbconvert? ( dev-python/nbconvert[${PYTHON_USEDEP}] )"
36
37 DEPEND="${CDEPEND}
38         dev-python/setuptools[${PYTHON_USEDEP}]
39         test? (
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}]
46         )
47         doc? (
48                 >=dev-python/ipykernel-5.1.0[${PYTHON_USEDEP}]
49                 >=dev-python/sphinx-2[${PYTHON_USEDEP}]
50         )"
51
52 PDEPEND="
53         notebook? (
54                 dev-python/notebook[${PYTHON_USEDEP}]
55                 dev-python/ipywidgets[${PYTHON_USEDEP}]
56                 dev-python/widgetsnbextension[${PYTHON_USEDEP}]
57         )
58         qt5? ( dev-python/qtconsole[${PYTHON_USEDEP}] )
59         smp? (
60                 >=dev-python/ipykernel-5.1.0[${PYTHON_USEDEP}]
61                 >=dev-python/ipyparallel-6.2.3[${PYTHON_USEDEP}]
62         )"
63
64 PATCHES=( "${FILESDIR}"/2.1.0-substitute-files.patch )
65
66 DISTUTILS_IN_SOURCE_BUILD=1
67
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
72
73         # Prevent un-needed download during build
74         if use doc; then
75                 sed -e "/^    'sphinx.ext.intersphinx',/d" -i docs/source/conf.py || die
76         fi
77
78         distutils-r1_python_prepare_all
79 }
80
81 python_compile_all() {
82         if use doc; then
83                 emake -C docs html_noapi
84                 HTML_DOCS=( docs/build/html/. )
85         fi
86 }
87
88 src_test() {
89         virtx distutils-r1_src_test
90 }
91
92 python_test() {
93         distutils_install_for_testing
94         pushd "${TEST_DIR}" >/dev/null || die
95         "${TEST_DIR}"/scripts/iptest || die
96         popd >/dev/null || die
97 }
98
99 python_install() {
100         distutils-r1_python_install
101
102         # Create ipythonX.Y symlinks.
103         # TODO:
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}
109 }
110
111 python_install_all() {
112         distutils-r1_python_install_all
113
114         if use examples; then
115                 dodoc -r examples
116                 docompress -x /usr/share/doc/${PF}/examples
117         fi
118 }
119
120 pkg_postinst() {
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
125
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."
131                 fi
132         fi
133 }