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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A06BE138350 for ; Tue, 21 Apr 2020 10:21:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B9767E08A2; Tue, 21 Apr 2020 10:21:01 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 96561E08A2 for ; Tue, 21 Apr 2020 10:21:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 387EA34F0D2 for ; Tue, 21 Apr 2020 10:21:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E6D251E8 for ; Tue, 21 Apr 2020 10:20:58 +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: <1587464288.117147f43ceec694083a3c4749a6ecde64f76ade.andrewammerlaan@gentoo> Subject: [gentoo-commits] repo/proj/guru:master commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/docs.eclass X-VCS-Directories: eclass/ X-VCS-Committer: andrewammerlaan X-VCS-Committer-Name: Andrew Ammerlaan X-VCS-Revision: 117147f43ceec694083a3c4749a6ecde64f76ade X-VCS-Branch: master Date: Tue, 21 Apr 2020 10:20:58 +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: 3dbd396b-2e85-49a2-a72b-5694cce18acd X-Archives-Hash: 30c49117759b964bb1b744a3c96b0160 commit: 117147f43ceec694083a3c4749a6ecde64f76ade Author: Andrew Ammerlaan riseup net> AuthorDate: Tue Apr 21 10:18:08 2020 +0000 Commit: Andrew Ammerlaan riseup net> CommitDate: Tue Apr 21 10:18:08 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=117147f4 eclass/docs: add doxygen support Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Andrew Ammerlaan riseup.net> eclass/docs.eclass | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/eclass/docs.eclass b/eclass/docs.eclass index c3fb6e3..b97f346 100644 --- a/eclass/docs.eclass +++ b/eclass/docs.eclass @@ -89,6 +89,15 @@ esac # # Defaults to ${DOCDIR}/_build/html +# @ECLASS-VARIABLE: DOCS_CONFIG_NAME +# @DESCRIPTION: +# Name of the doc builder config file. +# +# Only relevant for doxygen, as it allows +# config files with non-standard names +# +# Defaults to Doxyfile for doxygen + if [[ ! ${_DOCS} ]]; then # For the python based DOCBUILDERS we need to inherit python-any-r1 @@ -108,6 +117,10 @@ case "${DOCBUILDER}" in inherit python-any-r1 fi ;; + "doxygen") + # do not need to inherit anything for doxygen + true + ;; "") die "DOCBUILDER unset, should be set to use ${ECLASS}" ;; @@ -243,6 +256,40 @@ mkdocs_compile() { rm "${OUTDIR}"/*.gz || die } +# @FUNCTION: doxygen_setup +# @DESCRIPTION: +# Sets dependencies for doxygen +doxygen_setup() { + debug-print-function ${FUNCNAME} + + DOCDEPEND="app-doc/doxygen + ${DOCDEPEND}" +} + +# @FUNCTION: mkdocs_compile +# @DESCRIPTION: +# Calls mkdocs to build docs. +# +# If you overwrite src_compile or python_compile_all +# do not call this function, call docs_compile instead +doxygen_compile() { + debug-print-function ${FUNCNAME} + use doc || return + + : ${DOCS_CONFIG_NAME:="Doxyfile"} + + local doxyfile=${DOCDIR}/${DOCS_CONFIG_NAME} + [[ -f ${doxyfile} ]] || + die "${doxyfile} not found, DOCDIR=${DOCDIR} or DOCS_CONFIG_NAME=${DOCS_CONFIG_NAME} wrong" + + # doxygen wants the HTML_OUTPUT dir to already exist + mkdir -p "${OUTDIR}" + + pushd "${DOCDIR}" + (cat "${doxyfile}" ; echo "HTML_OUTPUT=${OUTDIR}") | doxygen - || die + popd +} + # @FUNCTION: docs_compile # @DESCRIPTION: # Calls DOCBUILDER and sets HTML_DOCS @@ -270,6 +317,9 @@ docs_compile() { "mkdocs") mkdocs_compile ;; + "doxygen") + doxygen_compile + ;; esac HTML_DOCS+=( "${OUTDIR}/." ) @@ -294,6 +344,9 @@ case "${DOCBUILDER}" in python_append_deps mkdocs_setup ;; + "doxygen") + doxygen_setup + ;; esac if [[ ${EAPI} == [56] ]]; then @@ -305,7 +358,7 @@ fi # If this is a python package using distutils-r1 # then put the compile function in the specific # python function, else just put it in src_compile -if [[ ${_DISTUTILS_R1} ]]; then +if [[ ${_DISTUTILS_R1} && ( ${DOCBUILDER}="mkdocs" || ${DOCBUILDER}="sphinx" ) ]]; then python_compile_all() { docs_compile; } else src_compile() { docs_compile; } 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 56851138350 for ; Tue, 21 Apr 2020 10:20:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9A4D5E0894; Tue, 21 Apr 2020 10:20:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6DACAE0894 for ; Tue, 21 Apr 2020 10:20:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E01CB34F133 for ; Tue, 21 Apr 2020 10:20:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6EAE69C for ; Tue, 21 Apr 2020 10:20:37 +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: <1587464288.117147f43ceec694083a3c4749a6ecde64f76ade.andrewammerlaan@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/docs.eclass X-VCS-Directories: eclass/ X-VCS-Committer: andrewammerlaan X-VCS-Committer-Name: Andrew Ammerlaan X-VCS-Revision: 117147f43ceec694083a3c4749a6ecde64f76ade X-VCS-Branch: dev Date: Tue, 21 Apr 2020 10:20:37 +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: d4a29327-e730-4508-b955-d66211bae3a0 X-Archives-Hash: 1ee7d67bf30733c29436779d309dba6c Message-ID: <20200421102037.RglA1WmqNokacfPdW_tSlL5rt4LzirPVnKBY2rAPDbc@z> commit: 117147f43ceec694083a3c4749a6ecde64f76ade Author: Andrew Ammerlaan riseup net> AuthorDate: Tue Apr 21 10:18:08 2020 +0000 Commit: Andrew Ammerlaan riseup net> CommitDate: Tue Apr 21 10:18:08 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=117147f4 eclass/docs: add doxygen support Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Andrew Ammerlaan riseup.net> eclass/docs.eclass | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/eclass/docs.eclass b/eclass/docs.eclass index c3fb6e3..b97f346 100644 --- a/eclass/docs.eclass +++ b/eclass/docs.eclass @@ -89,6 +89,15 @@ esac # # Defaults to ${DOCDIR}/_build/html +# @ECLASS-VARIABLE: DOCS_CONFIG_NAME +# @DESCRIPTION: +# Name of the doc builder config file. +# +# Only relevant for doxygen, as it allows +# config files with non-standard names +# +# Defaults to Doxyfile for doxygen + if [[ ! ${_DOCS} ]]; then # For the python based DOCBUILDERS we need to inherit python-any-r1 @@ -108,6 +117,10 @@ case "${DOCBUILDER}" in inherit python-any-r1 fi ;; + "doxygen") + # do not need to inherit anything for doxygen + true + ;; "") die "DOCBUILDER unset, should be set to use ${ECLASS}" ;; @@ -243,6 +256,40 @@ mkdocs_compile() { rm "${OUTDIR}"/*.gz || die } +# @FUNCTION: doxygen_setup +# @DESCRIPTION: +# Sets dependencies for doxygen +doxygen_setup() { + debug-print-function ${FUNCNAME} + + DOCDEPEND="app-doc/doxygen + ${DOCDEPEND}" +} + +# @FUNCTION: mkdocs_compile +# @DESCRIPTION: +# Calls mkdocs to build docs. +# +# If you overwrite src_compile or python_compile_all +# do not call this function, call docs_compile instead +doxygen_compile() { + debug-print-function ${FUNCNAME} + use doc || return + + : ${DOCS_CONFIG_NAME:="Doxyfile"} + + local doxyfile=${DOCDIR}/${DOCS_CONFIG_NAME} + [[ -f ${doxyfile} ]] || + die "${doxyfile} not found, DOCDIR=${DOCDIR} or DOCS_CONFIG_NAME=${DOCS_CONFIG_NAME} wrong" + + # doxygen wants the HTML_OUTPUT dir to already exist + mkdir -p "${OUTDIR}" + + pushd "${DOCDIR}" + (cat "${doxyfile}" ; echo "HTML_OUTPUT=${OUTDIR}") | doxygen - || die + popd +} + # @FUNCTION: docs_compile # @DESCRIPTION: # Calls DOCBUILDER and sets HTML_DOCS @@ -270,6 +317,9 @@ docs_compile() { "mkdocs") mkdocs_compile ;; + "doxygen") + doxygen_compile + ;; esac HTML_DOCS+=( "${OUTDIR}/." ) @@ -294,6 +344,9 @@ case "${DOCBUILDER}" in python_append_deps mkdocs_setup ;; + "doxygen") + doxygen_setup + ;; esac if [[ ${EAPI} == [56] ]]; then @@ -305,7 +358,7 @@ fi # If this is a python package using distutils-r1 # then put the compile function in the specific # python function, else just put it in src_compile -if [[ ${_DISTUTILS_R1} ]]; then +if [[ ${_DISTUTILS_R1} && ( ${DOCBUILDER}="mkdocs" || ${DOCBUILDER}="sphinx" ) ]]; then python_compile_all() { docs_compile; } else src_compile() { docs_compile; }