*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / docutils / docutils-0.13.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_6 pypy3 )
7
8 inherit distutils-r1
9
10 DESCRIPTION="Python Documentation Utilities"
11 HOMEPAGE="http://docutils.sourceforge.net/ https://pypi.org/project/docutils/"
12 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
13
14 LICENSE="BSD-2 GPL-3 public-domain"
15 SLOT="0"
16 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE=""
18
19 DEPEND="dev-python/pygments[${PYTHON_USEDEP}]"
20 RDEPEND="${DEPEND}"
21
22 python_compile_all() {
23         # Generate html docs from reStructured text sources.
24
25         # Place html4css1.css in base directory to ensure that the generated reference to it is correct.
26         cp docutils/writers/html4css1/html4css1.css . || die
27
28         cd tools || die
29         "${EPYTHON}" buildhtml.py --input-encoding=utf-8 \
30                 --stylesheet-path=../html4css1.css, --traceback ../docs || die
31 }
32
33 python_test() {
34         if python_is_python3; then
35                 pushd test3 > /dev/null || die
36         else
37                 pushd test > /dev/null || die
38         fi
39         "${EPYTHON}" alltests.py || die "Testing failed with ${EPYTHON}"
40         popd > /dev/null || die
41 }
42
43 python_install() {
44         distutils-r1_python_install
45
46         # Install tools.
47         python_doscript tools/{buildhtml,quicktest}.py
48 }
49
50 install_txt_doc() {
51         local doc="${1}"
52         local dir="txt/$(dirname ${doc})"
53         docinto "${dir}"
54         dodoc "${doc}"
55 }
56
57 python_install_all() {
58         local DOCS=( *.txt )
59         local HTML_DOCS=( docs tools docutils/writers/html4css1/html4css1.css )
60
61         distutils-r1_python_install_all
62
63         local doc
64         while IFS= read -r -d '' doc; do
65                 install_txt_doc "${doc}"
66         done < <(find docs tools -name '*.txt' -print0)
67 }