diff options
author | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2023-08-25 11:10:10 +0200 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2023-08-25 11:12:16 +0200 |
commit | db04534a538f2980e1d48dfbec7a8d4143c75d0a (patch) | |
tree | 453eac6a059f59bf038ff196512e7244141db310 /eclass/docs.eclass | |
parent | app-editors/bvi: Stabilize 1.4.2 ppc, #912985 (diff) | |
download | gentoo-db04534a538f2980e1d48dfbec7a8d4143c75d0a.tar.gz gentoo-db04534a538f2980e1d48dfbec7a8d4143c75d0a.tar.bz2 gentoo-db04534a538f2980e1d48dfbec7a8d4143c75d0a.zip |
docs.eclass: fix sphinx/mkdocs docs building in pep517 mode
This patch copies the sphinx-build logic from python-utils-r1.eclass to use
'python -m mkdocs' instead of plain 'mkdocs' whenever possible. This fixes
building mkdocs themes in pep517 mode where the very themes we are installing
would otherwise be unavailable for building the documentation.
Closes: https://bugs.gentoo.org/878047
Closes: https://bugs.gentoo.org/877823
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'eclass/docs.eclass')
-rw-r--r-- | eclass/docs.eclass | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/eclass/docs.eclass b/eclass/docs.eclass index 1aa4937a6363..bd2f252eff55 100644 --- a/eclass/docs.eclass +++ b/eclass/docs.eclass @@ -269,8 +269,18 @@ sphinx_compile() { sed -i -e 's:^intersphinx_mapping:disabled_&:' \ "${DOCS_DIR}"/conf.py || die # not all packages include the Makefile in pypi tarball - sphinx-build -b html -d "${DOCS_OUTDIR}"/_build/doctrees "${DOCS_DIR}" \ - "${DOCS_OUTDIR}" || die "${FUNCNAME}: sphinx-build failed" + local command=( "${EPYTHON}" -m sphinx.cmd.build ) + if ! "${EPYTHON}" -c "import sphinx.cmd.build" 2>/dev/null; then + command=( sphinx-build ) + fi + command+=( + -b html + -d "${DOCS_OUTDIR}"/_build/doctrees + "${DOCS_DIR}" + "${DOCS_OUTDIR}" + ) + echo "${command[@]}" >&2 + "${command[@]}" || die "${FUNCNAME}: sphinx-build failed" HTML_DOCS+=( "${DOCS_OUTDIR}" ) @@ -316,9 +326,17 @@ mkdocs_compile() { [[ -f ${mkdocsyml} ]] || die "${FUNCNAME}: ${mkdocsyml} not found, DOCS_DIR=${DOCS_DIR} wrong" - pushd "${DOCS_DIR}" || die - mkdocs build -d "${DOCS_OUTDIR}" || die "${FUNCNAME}: mkdocs build failed" - popd || die + pushd "${DOCS_DIR}" >/dev/null || die + local command=( "${EPYTHON}" -m mkdocs build ) + if ! "${EPYTHON}" -c "import mkdocs" 2>/dev/null; then + command=( mkdocs build ) + fi + command+=( + -d "${DOCS_OUTDIR}" + ) + echo "${command[@]}" >&2 + "${command[@]}" || die "${FUNCNAME}: mkdocs build failed" + popd >/dev/null || die # remove generated .gz variants # mkdocs currently has no option to disable this |