1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
10 DESCRIPTION="Python Documentation Utilities"
11 HOMEPAGE="http://docutils.sourceforge.net/ https://pypi.python.org/pypi/docutils"
12 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
13 SRC_URI+=" glep? ( mirror://gentoo/glep-0.4-r1.tbz2 )"
15 LICENSE="BSD-2 GPL-3 public-domain"
17 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
20 RDEPEND="dev-python/pygments[${PYTHON_USEDEP}]"
23 GLEP_SRC="${WORKDIR}/glep-0.4-r1"
25 python_prepare_all() {
26 # It's easier to move them around now.
27 # TODO: add python_newmodule?
29 mkdir "${GLEP_SRC}"/{read,trans} || die
30 mv "${GLEP_SRC}"/{glepread,read/glep}.py || die
31 mv "${GLEP_SRC}"/{glepstrans,trans/gleps}.py || die
34 distutils-r1_python_prepare_all
37 python_compile_all() {
38 # Generate html docs from reStructured text sources.
40 # Place html4css1.css in base directory to ensure that the generated reference to it is correct.
41 cp docutils/writers/html4css1/html4css1.css . || die
44 "${PYTHON}" buildhtml.py --input-encoding=utf-8 \
45 --stylesheet-path=../html4css1.css --traceback ../docs || die
50 [[ ${EPYTHON} == python3* ]] && tests=test3
52 cp -r -l ${tests} "${BUILD_DIR}"/test || die
53 ln -s "${S}"/docs "${BUILD_DIR}"/ || die
54 "${PYTHON}" "${BUILD_DIR}"/test/alltests.py || die "Tests fail with ${EPYTHON}"
58 distutils-r1_python_install
61 python_doscript tools/{buildhtml,quicktest}.py
63 # Install Gentoo GLEP tools.
65 python_doscript "${GLEP_SRC}"/glep.py
67 python_moduleinto docutils/readers
68 python_domodule "${GLEP_SRC}"/read/glep.py
69 python_moduleinto docutils/transforms
70 python_domodule "${GLEP_SRC}"/trans/gleps.py
71 python_moduleinto docutils/writers
72 python_domodule "${GLEP_SRC}"/glep_html
78 local dir="txt/$(dirname ${doc})"
83 python_install_all() {
85 local HTML_DOCS=( docs tools docutils/writers/html4css1/html4css1.css )
87 distutils-r1_python_install_all
90 while IFS= read -r -d '' doc; do
91 install_txt_doc "${doc}"
92 done < <(find docs tools -name '*.txt' -print0)