docs.eclass
Description
A simple eclass providing basic functions and variables to build documentation.
Please note that this eclass appends to RDEPEND and DEPEND
unconditionally for you.
This eclass also appends doc to IUSE, and sets HTML_DOCS
to the location of the compiled documentation automatically,
einstalldocs will then automatically install the documentation
to the correct directory.
The aim of this eclass is to make it easy to add additional
doc builders. To do this, add a <DOCS_BUILDER>_deps and
<DOCS_BUILDER>_compile function for your doc builder.
For python based doc builders you can use the
python_append_deps function to append [${PYTHON_USEDEP}]
automatically to additional dependencies.
Example use doxygen:
DOCS_BUILDER="doxygen"
DOCS_DEPEND="media-gfx/imagemagick"
DOCS_DIR="docs"
inherit docs
...
src_compile() {
      default
      docs_compile
}
        Example use mkdocs with distutils-r1:
DOCS_BUILDER="mkdocs"
DOCS_DEPEND="dev-python/mkdocs-material"
DOCS_DIR="doc"
PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1 docs
...
      Functions
- docs_compile
 - 
            
Calls
DOCS_BUILDERand setsHTML_DOCSThis function must be called in
src_compile. Take care not to overwrite the variables set by it. Ifdistutils-r1is inherited before this eclass, thandocs_compilewill be automatically added topython_compile_all()and there is no need to call it manually. Note that this function checks ifUSE="doc"is enabled, and if not automatically exits. Therefore, there is no need to wrap this function in aifstatement.Example use:
src_compile() { default docs_compile } 
Variables
- DOCS_BUILDER (REQUIRED) (SET BEFORE INHERIT)
 - 
            
Sets the doc builder to use, currently supports
sphinx,mkdocsanddoxygen.PYTHON_COMPATshould be set for python based doc builders:sphinxandmkdocs - DOCS_DIR
 - 
            
Path containing the doc builder config file(s).
For
sphinxthis is the location ofconf.pyFor
mkdocsthis is the location ofmkdocs.ymlNote thatmkdocs.ymloften does not reside in the same directory as the actual doc filesFor
doxygenthe default name isDoxyfile, but package may use a non-standard name. If this is the case one should setDOCS_CONFIG_NAMEto the correct nameDefaults to
${S} - DOCS_DEPEND (SET BEFORE INHERIT)
 - 
            
Sets additional dependencies required to build the documentation. For
sphinxandmkdocsthese dependencies should be specified without[${PYTHON_USEDEP}], this is added by the eclass. E.g. to depend onmkdocs-material:DOCS_DEPEND="dev-python/mkdocs-material"This eclass appends to this variable, this makes it possible to call it later in your ebuild again if necessary.
 - DOCS_AUTODOC (SET BEFORE INHERIT)
 - 
            
Sets whether to use
sphinx.ext.autodoc/mkautodocDefaults to 1 (True) forsphinx, and 0 (False) formkdocs. Not relevant fordoxygen. - DOCS_OUTDIR
 - 
            
Sets the directory where the documentation should be built into. There is no real reason to change this. However, this variable is useful if the package should also install other HTML files.
Example use:
HTML_DOCS=( "${yourdocs}" "${DOCS_OUTDIR}/." )Defaults to
${S}/_build/html - DOCS_CONFIG_NAME
 - 
            
Name of the doc builder config file.
Only relevant for
doxygen, as it allows config files with non-standard names. Does not do anything formkdocsorsphinx.Defaults to
Doxyfilefordoxygen 
Authors
Author: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Based on the work of: Michał Górny <mgorny@gentoo.org>
Maintainers
Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Reporting Bugs
Please report bugs via https://bugs.gentoo.org/