Gentoo's python-docs recently learned how to install objects.inv (with
the 2.7.6, 3.3.5, and 3.4.0 ebuilds, but without a revbump [1]).
Avoid the troublesome web access [2,3]:
loading intersphinx inventory from http://docs.python.org/objects.inv...
Unfortunately, the approach to locating the local objects.inv is a bit
awkward. Ideally there would be some sort of pkg-config approach to
listing a package's HTML doc directory :p, but until then the best I
can do is shell out to ls with an EROOT-based glob. Using ROOT in
ebuild functions is illegal though [4] (and by extension, using it via
EROOT may be illegal as well). Even if it was legal, you're going to
run into trouble if the python-docs dependency was installed with a
different ROOT, which is why I die if PYTHON_DOC is empty.
[1]: https://bugs.gentoo.org/show_bug.cgi?id=521768
Summary: dev-python/python-docs-3.4.0 doesn't install objects.inv
for intersphinx
[2]: https://bugs.gentoo.org/show_bug.cgi?id=522064
Summary: should explicitly disallow network access from existing
ebuild functions
[3]: https://github.com/gentoo/devmanual.gentoo.org/pull/21
Summary: ebuild-writing/functions: Don't allow network access
[4]: http://devmanual.gentoo.org/ebuild-writing/common-mistakes/#invalid-use-of-root
dev-python/setuptools[${PYTHON_USEDEP}]
doc? (
${RDEPEND}
+ dev-python/python-docs[${PYTHON_USEDEP}]
dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
)
test? (
S="${WORKDIR}/${MY_P}"
+python_prepare_all() {
+ if use doc; then
+ local PYTHON_DOC_INVENTORIES=$(ls "${EROOT}usr/share/doc"/python-docs-*/html/objects.inv)
+ local PYTHON_DOC_INVENTORY="${PYTHON_DOC_INVENTORIES##*
+}"
+ local PYTHON_DOC="${PYTHON_DOC_INVENTORY##${ROOT%/}}"
+ PYTHON_DOC="${PYTHON_DOC%%objects.inv}"
+ if [[ -z "${PYTHON_DOC}" ]]
+ then
+ die "python-docs not found in ${EROOT}usr/share/doc"
+ fi
+ sed -i "s|'http://docs.python.org/': None|'${PYTHON_DOC}': '${PYTHON_DOC_INVENTORY}'|" docs/conf.py || die
+ fi
+ distutils-r1_python_prepare_all
+}
+
python_compile_all() {
use doc && emake -C docs html
}