*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / translate-toolkit / translate-toolkit-2.3.1.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="sqlite"
8
9 inherit distutils-r1
10
11 DESCRIPTION="Toolkit to convert between many translation formats"
12 HOMEPAGE="https://github.com/translate/translate"
13 SRC_URI="https://github.com/translate/translate/releases/download/${PV}/${P}.tar.gz"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="amd64 arm64 x86 ~amd64-linux ~x86-linux"
18 IUSE="doc +html +ical +ini +subtitles +yaml"
19
20 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
21
22 BDEPEND="
23         dev-python/setuptools[${PYTHON_USEDEP}]
24         doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
25 "
26 DEPEND="
27         >=dev-python/six-1.10.0[${PYTHON_USEDEP}]
28 "
29 RDEPEND="${DEPEND}
30         !dev-python/pydiff
31         app-text/iso-codes
32         >=dev-python/chardet-3.0.4[${PYTHON_USEDEP}]
33         dev-python/diff-match-patch[${PYTHON_USEDEP}]
34         >=dev-python/lxml-3.5[${PYTHON_USEDEP}]
35         >=dev-python/pycountry-18.5.26[${PYTHON_USEDEP}]
36         >=dev-python/python-levenshtein-0.12.0[${PYTHON_USEDEP}]
37         sys-devel/gettext
38         html? ( dev-python/utidylib[${PYTHON_USEDEP}] )
39         ical? ( dev-python/vobject[${PYTHON_USEDEP}] )
40         ini? ( dev-python/iniparse[${PYTHON_USEDEP}] )
41         subtitles? ( media-video/gaupol[${PYTHON_USEDEP}] )
42         yaml? ( dev-python/pyyaml[${PYTHON_USEDEP}] )
43 "
44
45 python_prepare_all() {
46         # Prevent unwanted d'loading in doc build
47         sed -e "/^    'sphinx.ext.intersphinx',/d" \
48                 -e "/html_theme/ s/sphinx-bootstrap/classic/" \
49                 -i docs/conf.py || die
50
51         distutils-r1_python_prepare_all
52 }
53
54 python_compile_all() {
55         if use doc; then
56                 emake -C docs html
57                 HTML_DOCS=( "${S}"/docs/_build/html/. )
58         fi
59 }
60
61 python_install_all() {
62         distutils-r1_python_install_all
63
64         rm -Rf docs || die
65         if ! use html; then
66                 rm "${ED}"/usr/bin/{html2po,po2html} || die
67         fi
68         if ! use ical; then
69                 rm "${ED}"/usr/bin/{ical2po,po2ical} || die
70         fi
71         if ! use ini; then
72                 rm "${ED}"/usr/bin/{ini2po,po2ini} || die
73         fi
74         if ! use subtitles; then
75                 rm "${ED}"/usr/bin/{sub2po,po2sub} || die
76         fi
77 }