| 1 |
patrick |
1.2 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
patrick |
1.1 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
armin76 |
1.11 |
# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/sphinx-1.1.2.ebuild,v 1.10 2012/04/17 21:59:32 ranger Exp $
|
| 4 |
patrick |
1.1 |
|
| 5 |
|
|
EAPI="3"
|
| 6 |
|
|
PYTHON_DEPEND="2"
|
| 7 |
|
|
SUPPORT_PYTHON_ABIS="1"
|
| 8 |
jlec |
1.4 |
RESTRICT_PYTHON_ABIS="3.*"
|
| 9 |
patrick |
1.1 |
DISTUTILS_SRC_TEST="nosetests"
|
| 10 |
|
|
|
| 11 |
|
|
inherit distutils
|
| 12 |
|
|
|
| 13 |
|
|
MY_PN="Sphinx"
|
| 14 |
|
|
MY_P="${MY_PN}-${PV}"
|
| 15 |
|
|
|
| 16 |
|
|
DESCRIPTION="Python documentation generator"
|
| 17 |
|
|
HOMEPAGE="http://sphinx.pocoo.org/ http://pypi.python.org/pypi/Sphinx"
|
| 18 |
|
|
SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
|
| 19 |
|
|
|
| 20 |
|
|
LICENSE="BSD"
|
| 21 |
|
|
SLOT="0"
|
| 22 |
armin76 |
1.11 |
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
|
| 23 |
patrick |
1.1 |
IUSE="doc latex"
|
| 24 |
|
|
|
| 25 |
|
|
DEPEND=">=dev-python/docutils-0.7
|
| 26 |
|
|
>=dev-python/jinja-2.3
|
| 27 |
|
|
>=dev-python/pygments-1.2
|
| 28 |
|
|
dev-python/setuptools
|
| 29 |
|
|
latex? ( dev-texlive/texlive-latexextra )"
|
| 30 |
|
|
RDEPEND="${DEPEND}"
|
| 31 |
|
|
|
| 32 |
|
|
S="${WORKDIR}/${MY_P}"
|
| 33 |
|
|
|
| 34 |
|
|
DOCS="CHANGES"
|
| 35 |
|
|
|
| 36 |
|
|
src_compile() {
|
| 37 |
|
|
distutils_src_compile
|
| 38 |
|
|
|
| 39 |
|
|
if use doc; then
|
| 40 |
|
|
pushd doc > /dev/null
|
| 41 |
|
|
einfo "Generation of documentation"
|
| 42 |
|
|
PYTHONPATH=".." emake SPHINXBUILD="$(PYTHON -f) ../sphinx-build.py" html || die "Generation of documentation failed"
|
| 43 |
|
|
popd > /dev/null
|
| 44 |
|
|
fi
|
| 45 |
|
|
}
|
| 46 |
|
|
|
| 47 |
|
|
src_install() {
|
| 48 |
|
|
distutils_src_install
|
| 49 |
|
|
|
| 50 |
|
|
if use doc; then
|
| 51 |
|
|
dohtml -A txt -r doc/_build/html/* || die "Installation of documentation failed"
|
| 52 |
|
|
fi
|
| 53 |
|
|
}
|
| 54 |
|
|
|
| 55 |
|
|
pkg_postinst() {
|
| 56 |
|
|
distutils_pkg_postinst
|
| 57 |
|
|
|
| 58 |
|
|
# Generate the Grammar pickle to avoid sandbox violations.
|
| 59 |
|
|
generation_of_grammar_pickle() {
|
| 60 |
|
|
"$(PYTHON)" -c "import sys; sys.path.insert(0, '${EROOT}$(python_get_sitedir -b)'); from sphinx.pycode.pgen2.driver import load_grammar; load_grammar('${EROOT}$(python_get_sitedir -b)/sphinx/pycode/Grammar.txt')"
|
| 61 |
|
|
}
|
| 62 |
|
|
python_execute_function \
|
| 63 |
|
|
--action-message 'Generation of Grammar pickle with $(python_get_implementation_and_version)...' \
|
| 64 |
|
|
--failure-message 'Generation of Grammar pickle with $(python_get_implementation_and_version) failed' \
|
| 65 |
|
|
generation_of_grammar_pickle
|
| 66 |
|
|
}
|
| 67 |
|
|
|
| 68 |
|
|
pkg_postrm() {
|
| 69 |
|
|
distutils_pkg_postrm
|
| 70 |
|
|
|
| 71 |
|
|
deletion_of_grammar_pickle() {
|
| 72 |
|
|
rm -f "${EROOT}$(python_get_sitedir -b)/sphinx/pycode"/Grammar*.pickle || return 1
|
| 73 |
|
|
|
| 74 |
|
|
# Delete empty parent directories.
|
| 75 |
|
|
local dir="${EROOT}$(python_get_sitedir -b)/sphinx/pycode"
|
| 76 |
|
|
while [[ "${dir}" != "${EROOT%/}" ]]; do
|
| 77 |
|
|
rmdir "${dir}" 2> /dev/null || break
|
| 78 |
|
|
dir="${dir%/*}"
|
| 79 |
|
|
done
|
| 80 |
|
|
}
|
| 81 |
|
|
python_execute_function \
|
| 82 |
|
|
--action-message 'Deletion of Grammar pickle with $(python_get_implementation_and_version)...' \
|
| 83 |
|
|
--failure-message 'Deletion of Grammar pickle with $(python_get_implementation_and_version) failed' \
|
| 84 |
|
|
deletion_of_grammar_pickle
|
| 85 |
|
|
}
|