version 2: now prepending dev-python/sphinx before calling python_gen_*_dep functions as suggested by @mgorny. The check that prevents --no-autodoc form being set while additional dependencies are added is moved into the if statement, because ${deps} is now always non empty.

Best regards,
Andrew

On 16/01/2021 18:19, Michał Górny wrote:
On Sat, 2021-01-16 at 14:49 +0100, Andrew Ammerlaan wrote:
See my previous email for the rational behind these changes. This closes
https://bugs.gentoo.org/704520 and the PR is here:
https://github.com/gentoo/gentoo/pull/19078

This eclass is maintained by @mgorny, so I would like to hear his
thoughts on these changes in particular.

Best regards,
Andrew

I see an opportunity to move prepending sphinx before in the common
code.



From caf841204458e618a1a6d388717a731e7cd94b88 Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <[email protected]>
Date: Sat, 16 Jan 2021 14:27:00 +0100
Subject: [PATCH] eclass/distutils-r1: fix distutils_enable_sphinx with
 DISTUTILS_SINGLE_IMPL

python-single-r1 does not have the python_gen_any_dep function
use the python_gen_cond_dep instead

Closes: https://bugs.gentoo.org/704520

Signed-off-by: Andrew Ammerlaan <[email protected]>
---
 eclass/distutils-r1.eclass | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 5ffc91be479cb..3d2bec5bfcb32 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -316,22 +316,25 @@ distutils_enable_sphinx() {
        _DISTUTILS_SPHINX_PLUGINS=( "${@}" )

        local deps autodoc=1 d
+       deps="dev-python/sphinx[\${PYTHON_USEDEP}]"
        for d; do
                if [[ ${d} == --no-autodoc ]]; then
                        autodoc=
                else
                        deps+="
                                ${d}[\${PYTHON_USEDEP}]"
+                       if [[ ! ${autodoc} ]]; then
+ die "${FUNCNAME}: do not pass --no-autodoc if external plugins are used"
+                       fi
                fi
        done

-       if [[ ! ${autodoc} && -n ${deps} ]]; then
-               die "${FUNCNAME}: do not pass --no-autodoc if external plugins are 
used"
-       fi
        if [[ ${autodoc} ]]; then
-               deps="$(python_gen_any_dep "
-                       dev-python/sphinx[\${PYTHON_USEDEP}]
-                       ${deps}")"
+               if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then
+                       deps="$(python_gen_cond_dep "${deps}")"
+               else
+                       deps="$(python_gen_any_dep "${deps}")"
+               fi

                python_check_deps() {
                        use doc || return 0

Reply via email to