*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / nbconvert / nbconvert-5.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
8 inherit distutils-r1
9
10 DESCRIPTION="Converting Jupyter Notebooks"
11 HOMEPAGE="https://nbconvert.readthedocs.io/"
12 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
14 LICENSE="BSD"
15 SLOT="0"
16 KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux"
17 IUSE="doc test"
18
19 RDEPEND="
20         dev-python/bleach[${PYTHON_USEDEP}]
21         dev-python/defusedxml[${PYTHON_USEDEP}]
22         >=dev-python/entrypoints-0.2.2[${PYTHON_USEDEP}]
23         dev-python/jinja[${PYTHON_USEDEP}]
24         dev-python/jupyter_core[${PYTHON_USEDEP}]
25         >=dev-python/mistune-0.7.4[${PYTHON_USEDEP}]
26         dev-python/nbformat[${PYTHON_USEDEP}]
27         >=dev-python/pandocfilters-1.4.1[${PYTHON_USEDEP}]
28         dev-python/pygments[${PYTHON_USEDEP}]
29         >=dev-python/traitlets-4.2.1[${PYTHON_USEDEP}]
30         dev-python/testpath[${PYTHON_USEDEP}]
31         www-servers/tornado[${PYTHON_USEDEP}]
32 "
33 DEPEND="
34         dev-python/setuptools[${PYTHON_USEDEP}]
35         doc? (
36                 ${RDEPEND}
37                 dev-python/ipython[${PYTHON_USEDEP}]
38                 dev-python/jupyter_client[${PYTHON_USEDEP}]
39                 dev-python/nbsphinx[${PYTHON_USEDEP}]
40                 dev-python/sphinx[${PYTHON_USEDEP}]
41                 dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
42         )
43         test? (
44                 ${RDEPEND}
45                 dev-python/nose[${PYTHON_USEDEP}]
46                 dev-python/pytest[${PYTHON_USEDEP}]
47                 dev-python/ipykernel[${PYTHON_USEDEP}]
48                 >=dev-python/jupyter_client-4.2[${PYTHON_USEDEP}]
49         )
50 "
51
52 # still failing in many places
53 RESTRICT=test
54
55 python_prepare_all() {
56         # Prevent un-needed download during build
57         if use doc; then
58                 sed -e "/^    'sphinx.ext.intersphinx',/d" -i docs/source/conf.py || die
59         fi
60         distutils-r1_python_prepare_all
61 }
62
63 python_compile_all() {
64         if use doc; then
65                 emake -C docs html
66                 HTML_DOCS=( docs/build/html/. )
67         fi
68 }
69
70 python_test() {
71         distutils_install_for_testing
72         cd "${TEST_DIR}"/lib || die
73         pytest -v --pyargs nbconvert || die
74 }
75
76 pkg_postinst() {
77         if ! has_version app-text/pandoc ; then
78                 einfo "Pandoc is required for converting to formats other than Python,"
79                 einfo "HTML, and Markdown. If you need this functionality, install"
80                 einfo "app-text/pandoc."
81         fi
82 }