This patch moves some things around so we can then easily define a python_check_deps() function. The lack of this function causes problems
when building the documentation of packages that already have py3.12 in
compat while mkdocs does not have py3.12 yet. [1]
As an added bonus, some code duplication is removed.
Best regards,
Andrew
[1]
https://bugs.gentoo.org/910278
From 4f758c021094db0e4f2a085aba33a614f97200d1 Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <
andrewammerlaan@gentoo.org>
Date: Fri, 14 Jul 2023 09:40:59 +0200
Subject: [PATCH] docs.eclass: define python_check_deps()
and remove some code duplication
Closes:
https://bugs.gentoo.org/910278
Signed-off-by: Andrew Ammerlaan <
andrewammerlaan@gentoo.org>
---
eclass/docs.eclass | 59 ++++++++++++++++++++++++++--------------------
1 file changed, 33 insertions(+), 26 deletions(-)
diff --git a/eclass/docs.eclass b/eclass/docs.eclass
index da598226bfc0..1aa4937a6363 100644
--- a/eclass/docs.eclass
+++ b/eclass/docs.eclass
@@ -186,21 +186,36 @@ initialize_git_repo() {
fi
}
-# @FUNCTION: python_append_deps
+# @FUNCTION: _docs_set_python_deps
# @INTERNAL
# @DESCRIPTION:
-# Appends [\${PYTHON_USEDEP}] to all dependencies
-# for python based DOCS_BUILDERs such as mkdocs or
-# sphinx.
-python_append_deps() {
+# Add python_gen_any_dep or python_gen_cond_dep
+# to DOCS_DEPEND and define python_check_deps
+_docs_set_python_deps() {
debug-print-function ${FUNCNAME}
- local temp
+ local deps=${@}
+ python_check_deps() {
+ use doc || return 0
+
+ local dep
+ for dep in ${deps[@]}; do
+ python_has_version "${dep}[${PYTHON_USEDEP}]" ||
+ return 1
+ done
+ }
+
+ local deps_appended
local dep
- for dep in ${DOC