*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / jinja / jinja-2.10.3.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=( python2_7 python3_{6,7} pypy3 )
7 PYTHON_REQ_USE="threads(+)"
8
9 inherit distutils-r1
10
11 DESCRIPTION="A full-featured template engine for Python"
12 HOMEPAGE="http://jinja.pocoo.org/ https://pypi.org/project/Jinja2/"
13
14 # pypi tarball is missing tests
15 SRC_URI="https://github.com/pallets/jinja/archive/${PV}.tar.gz -> ${P}.tar.gz"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris"
20 IUSE="doc examples test"
21 RESTRICT="!test? ( test )"
22
23 CDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
24         !dev-python/jinja:compat"
25 RDEPEND="${CDEPEND}
26         dev-python/markupsafe[${PYTHON_USEDEP}]"
27 BDEPEND="${CDEPEND}
28         doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
29
30 distutils_enable_tests pytest
31
32 # XXX: handle Babel better?
33
34 wrap_opts() {
35         local mydistutilsargs=()
36
37         if [[ ${EPYTHON} == python* ]]; then
38                 mydistutilargs+=( --with-debugsupport )
39         fi
40
41         "${@}"
42 }
43
44 python_prepare() {
45         # async is not supported on python2
46         if ! python_is_python3; then
47                 rm -f jinja2/async*.py || die "Failed to remove async from python2"
48         fi
49 }
50
51 python_compile() {
52         wrap_opts distutils-r1_python_compile
53 }
54
55 python_compile_all() {
56         use doc && emake -C docs html
57 }
58
59 python_install_all() {
60         use doc && local HTML_DOCS=( docs/_build/html/. )
61         if use examples ; then
62                 docinto examples
63                 dodoc -r examples/.
64         fi
65
66         distutils-r1_python_install_all
67
68         insinto /usr/share/vim/vimfiles/syntax
69         doins ext/Vim/*
70 }
71
72 pkg_postinst() {
73         if ! has_version dev-python/Babel; then
74                 elog "For i18n support, please emerge dev-python/Babel."
75         fi
76 }