diff options
author | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-11-16 15:08:41 +0100 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-11-16 15:08:41 +0100 |
commit | e22fee1e68347f05d921a8f14d0a264358d62d9b (patch) | |
tree | 8fc7f94cefc1571a80648e10d4a46737d9ca2c22 /eclass | |
parent | dev-python/python-vlc: add 3.0.18121 (diff) | |
download | gentoo-e22fee1e68347f05d921a8f14d0a264358d62d9b.tar.gz gentoo-e22fee1e68347f05d921a8f14d0a264358d62d9b.tar.bz2 gentoo-e22fee1e68347f05d921a8f14d0a264358d62d9b.zip |
docs.eclass: allow multiple doc builders in one ebuild
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/docs.eclass | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/eclass/docs.eclass b/eclass/docs.eclass index 611485c227ff..8aa2b54d2b2f 100644 --- a/eclass/docs.eclass +++ b/eclass/docs.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: docs.eclass @@ -207,16 +207,15 @@ sphinx_deps() { } # @FUNCTION: sphinx_compile -# @INTERNAL # @DESCRIPTION: # Calls sphinx to build docs. -# -# If you overwrite python_compile_all do not call -# this function, call docs_compile instead sphinx_compile() { debug-print-function ${FUNCNAME} use doc || return + : ${DOCS_DIR:="${S}"} + : ${DOCS_OUTDIR:="${S}/_build/html/sphinx"} + local confpy=${DOCS_DIR}/conf.py [[ -f ${confpy} ]] || die "${FUNCNAME}: ${confpy} not found, DOCS_DIR=${DOCS_DIR} call wrong" @@ -236,6 +235,12 @@ sphinx_compile() { # 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" + + HTML_DOCS+=( "${DOCS_OUTDIR}" ) + + # We don't need these any more, unset them in case we want to call a + # second documentation builder. + unset DOCS_DIR DOCS_OUTDIR } # @FUNCTION: mkdocs_deps @@ -263,16 +268,15 @@ mkdocs_deps() { } # @FUNCTION: mkdocs_compile -# @INTERNAL # @DESCRIPTION: # Calls mkdocs to build docs. -# -# If you overwrite python_compile_all do not call -# this function, call docs_compile instead mkdocs_compile() { debug-print-function ${FUNCNAME} use doc || return + : ${DOCS_DIR:="${S}"} + : ${DOCS_OUTDIR:="${S}/_build/html/mkdocs"} + local mkdocsyml=${DOCS_DIR}/mkdocs.yml [[ -f ${mkdocsyml} ]] || die "${FUNCNAME}: ${mkdocsyml} not found, DOCS_DIR=${DOCS_DIR} wrong" @@ -285,6 +289,12 @@ mkdocs_compile() { # mkdocs currently has no option to disable this # and portage complains: "Colliding files found by ecompress" rm "${DOCS_OUTDIR}"/*.gz || die + + HTML_DOCS+=( "${DOCS_OUTDIR}" ) + + # We don't need these any more, unset them in case we want to call a + # second documentation builder. + unset DOCS_DIR DOCS_OUTDIR } # @FUNCTION: doxygen_deps @@ -299,14 +309,16 @@ doxygen_deps() { } # @FUNCTION: doxygen_compile -# @INTERNAL # @DESCRIPTION: # Calls doxygen to build docs. doxygen_compile() { debug-print-function ${FUNCNAME} use doc || return + # This is the default name of the config file, upstream can change it. : ${DOCS_CONFIG_NAME:="Doxyfile"} + : ${DOCS_DIR:="${S}"} + : ${DOCS_OUTDIR:="${S}/_build/html/doxygen"} local doxyfile=${DOCS_DIR}/${DOCS_CONFIG_NAME} [[ -f ${doxyfile} ]] || @@ -318,6 +330,12 @@ doxygen_compile() { pushd "${DOCS_DIR}" || die (cat "${DOCS_CONFIG_NAME}" ; echo "HTML_OUTPUT=${DOCS_OUTDIR}") | doxygen - || die "${FUNCNAME}: doxygen failed" popd || die + + HTML_DOCS+=( "${DOCS_OUTDIR}" ) + + # We don't need these any more, unset them in case we want to call a + # second documentation builder. + unset DOCS_DIR DOCS_OUTDIR DOCS_CONFIG_NAME } # @FUNCTION: docs_compile @@ -343,16 +361,8 @@ docs_compile() { debug-print-function ${FUNCNAME} use doc || return - # Set a sensible default as DOCS_DIR - : ${DOCS_DIR:="${S}"} - - # Where to put the compiled files? - : ${DOCS_OUTDIR:="${S}/_build/html"} - ${DOCS_BUILDER}_compile - HTML_DOCS+=( "${DOCS_OUTDIR}/." ) - # we need to ensure successful return in case we're called last, # otherwise Portage may wrongly assume sourcing failed return 0 |