From f3893ec93d2d62a2d2b3a77ad30b195414035241 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 2 Sep 2014 15:54:51 -0700 Subject: [PATCH] dev-python/flask-cors/flask-cors-9999.ebuild: Use local intersphinx 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/flask-cors/flask-cors-9999.ebuild | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dev-python/flask-cors/flask-cors-9999.ebuild b/dev-python/flask-cors/flask-cors-9999.ebuild index 5bc0f95..0534d2b 100644 --- a/dev-python/flask-cors/flask-cors-9999.ebuild +++ b/dev-python/flask-cors/flask-cors-9999.ebuild @@ -32,6 +32,7 @@ DEPEND=" dev-python/setuptools[${PYTHON_USEDEP}] doc? ( ${RDEPEND} + dev-python/python-docs[${PYTHON_USEDEP}] dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}] ) test? ( @@ -41,6 +42,22 @@ DEPEND=" 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 } -- 2.26.2