# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="5" PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3} pypy pypy2_0 ) inherit distutils-r1 DESCRIPTION="Python Documentation Utilities" HOMEPAGE="http://docutils.sourceforge.net/ http://pypi.python.org/pypi/docutils" SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" LICENSE="BSD-2 GPL-3 public-domain" SLOT="0" KEYWORDS="amd64 x86" IUSE="glep" DEPEND="dev-python/pygments[${PYTHON_USEDEP}]" RDEPEND="${DEPEND} glep? ( dev-python/docutils-glep[${PYTHON_USEDEP}] )" PATCHES=( # fix buildhtml.py option parsing "${FILESDIR}"/${P}-optparser.patch ) python_compile_all() { # Generate html docs from reStructured text sources. # Place html4css1.css in base directory to ensure that the generated reference to it is correct. cp docutils/writers/html4css1/html4css1.css . || die cd tools || die "${PYTHON}" buildhtml.py --input-encoding=utf-8 \ --stylesheet-path=../html4css1.css, --traceback ../docs || die } python_test() { local tests=test [[ ${EPYTHON} == python3* ]] && tests=test3 cp -r -l ${tests} "${BUILD_DIR}"/test || die ln -s "${S}"/docs "${BUILD_DIR}"/ || die "${PYTHON}" "${BUILD_DIR}"/test/alltests.py || die "Tests fail with ${EPYTHON}" } python_install() { distutils-r1_python_install # Install tools. python_doscript tools/{buildhtml,quicktest}.py } install_txt_doc() { local doc="${1}" local dir="txt/$(dirname ${doc})" docinto "${dir}" dodoc "${doc}" } python_install_all() { local DOCS=( *.txt ) local HTML_DOCS=( docs tools docutils/writers/html4css1/html4css1.css ) distutils-r1_python_install_all local doc while IFS= read -r -d '' doc; do install_txt_doc "${doc}" done < <(find docs tools -name '*.txt' -print0) }