summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-11-21 12:44:04 +0100
committerMichał Górny <mgorny@gentoo.org>2019-11-25 13:34:54 +0100
commit5e1537d4c32fdaf8a3b8bd31f114a65c7e6a09ad (patch)
treeeb49161defd9e521ef19e516518e642cf3862c12 /eclass
parentdev-python/tempest-lib: Fix MissingTestRestrict (diff)
downloadgentoo-5e1537d4c32fdaf8a3b8bd31f114a65c7e6a09ad.tar.gz
gentoo-5e1537d4c32fdaf8a3b8bd31f114a65c7e6a09ad.tar.bz2
gentoo-5e1537d4c32fdaf8a3b8bd31f114a65c7e6a09ad.zip
python-utils-r1.eclass: Introduce a build_sphinx() helper
Introduce a helper to build HTML docs using Sphinx, providing for Intersphinx cleanup and HTML_DOCS appending. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-utils-r1.eclass25
1 files changed, 25 insertions, 0 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 44337c687aad..4f3ac66f2150 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1343,6 +1343,31 @@ python_export_utf8_locale() {
return 0
}
+# @FUNCTION: build_sphinx
+# @USAGE: <directory>
+# @DESCRIPTION:
+# Build HTML documentation using dev-python/sphinx in the specified
+# <directory>. Takes care of disabling Intersphinx and appending
+# to HTML_DOCS.
+#
+# If <directory> is relative to the current directory, care needs
+# to be taken to run einstalldocs from the same directory
+# (usually ${S}).
+build_sphinx() {
+ debug-print-function ${FUNCNAME} "${@}"
+ [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: <directory>"
+
+ local dir=${1}
+
+ sed -i -e 's:^intersphinx_mapping:disabled_&:' \
+ "${dir}"/conf.py || die
+ # not all packages include the Makefile in pypi tarball
+ sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
+ "${dir}"/_build/html || die
+
+ HTML_DOCS+=( "${dir}/_build/html/." )
+}
+
# -- python.eclass functions --
_python_check_dead_variables() {