dev-python/flask-cors: Drop ROOT and use stricter python-docs dependencies
authorW. Trevor King <wking@tremily.us>
Mon, 8 Sep 2014 03:55:57 +0000 (20:55 -0700)
committerW. Trevor King <wking@tremily.us>
Mon, 8 Sep 2014 18:50:22 +0000 (11:50 -0700)
We're not supposed to use ROOT in ebuild functions (see the discussion
in f3893ec9, dev-python/flask-cors/flask-cors-9999.ebuild: Use local
intersphinx, 2014-09-02).  I had been using it to build against the
objects.inv from that ROOT, but we're actually supposed to build
against the local (non-ROOT) copy [1]:

  ROOT isn't used for library dependencies. When building, libraries,
  headers etc. on / have to be used. Cross-compiling etc is done by
  configuring the toolchain correctly, not by hacking ebuilds in a way
  that breaks binary packages.

I'm also using equery to list the python-docs files (on /), to avoid
hard-coding /usr/share/doc"/python-docs-*/html.  equery knows what was
installed, and I really don't care where it is, so long as I can find
the objects.inv (and so long as that's the directory with the HTML
docs too).

Finally, the python-docs dependencies make sure we accept any of the
python-docs versions that install objects.inv [2].  Ian Delaney bumped
versions to -r1 so we could determine if objects.inv was installed,
and Ian Stakenvicius pointed out the slotted approach to the disjoint
dependency.

[1]: https://bugs.gentoo.org/show_bug.cgi?id=258125#c0
[2]: https://bugs.gentoo.org/show_bug.cgi?id=521768

Thanks-to: Ian Delaney <idella4@gentoo.org>
Thanks-to: Ian Stakenvicius <axs@gentoo.org>

dev-python/flask-cors/flask-cors-9999.ebuild

index 0534d2b2ef1cf43ff73113148fc224e43e6046f0..343eaf15b4e84032c1666e6caa9b74d7a9a39df7 100644 (file)
@@ -32,7 +32,12 @@ DEPEND="
        dev-python/setuptools[${PYTHON_USEDEP}]
        doc? (
                ${RDEPEND}
-               dev-python/python-docs[${PYTHON_USEDEP}]
+               app-portage/gentoolkit
+               || (
+                       >=dev-python/python-docs-3.4.0-r1
+                       >=dev-python/python-docs-3.3.5-r1:3.3
+                       >=dev-python/python-docs-2.7.6-r1:2.7
+               )
                dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
        )
        test? (
@@ -44,15 +49,12 @@ 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}" ]]
+               local PYTHON_DOC_INVENTORY=$(equery files python-docs | grep objects.inv | tail -n1)
+               if [[ -z "${PYTHON_DOC_INVENTORY}" ]]
                then
-                       die "python-docs not found in ${EROOT}usr/share/doc"
+                       die "objects.inv not found in python-docs"
                fi
+               PYTHON_DOC="${PYTHON_DOC_INVENTORY%%objects.inv}"
                sed -i "s|'http://docs.python.org/': None|'${PYTHON_DOC}': '${PYTHON_DOC_INVENTORY}'|" docs/conf.py || die
        fi
        distutils-r1_python_prepare_all