From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A9C6515800A for ; Fri, 25 Aug 2023 09:12:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E8F3B2BC013; Fri, 25 Aug 2023 09:12:25 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9B5C2BC013 for ; Fri, 25 Aug 2023 09:12:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D66B2335DB2 for ; Fri, 25 Aug 2023 09:12:24 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6CF93F5A for ; Fri, 25 Aug 2023 09:12:23 +0000 (UTC) From: "Andrew Ammerlaan" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andrew Ammerlaan" Message-ID: <1692954736.db04534a538f2980e1d48dfbec7a8d4143c75d0a.andrewammerlaan@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/docs.eclass X-VCS-Directories: eclass/ X-VCS-Committer: andrewammerlaan X-VCS-Committer-Name: Andrew Ammerlaan X-VCS-Revision: db04534a538f2980e1d48dfbec7a8d4143c75d0a X-VCS-Branch: master Date: Fri, 25 Aug 2023 09:12:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9ef67dee-29c9-40f8-accc-a53fbb3086a7 X-Archives-Hash: 6f216987fd1525b4693e95d2a1c8e806 commit: db04534a538f2980e1d48dfbec7a8d4143c75d0a Author: Andrew Ammerlaan gentoo org> AuthorDate: Fri Aug 25 09:10:10 2023 +0000 Commit: Andrew Ammerlaan gentoo org> CommitDate: Fri Aug 25 09:12:16 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db04534a 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 gentoo.org> eclass/docs.eclass | 28 +++++++++++++++++++++++----- 1 file 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