Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH v2 1/5] python-utils-r1.eclass: Introduce build_sphins() helper
Date: Thu, 21 Nov 2019 11:47:08
Message-Id: 20191121114636.128873-1-mgorny@gentoo.org
1 Introduce a helper to build HTML docs using Sphinx, providing for
2 Intersphinx cleanup and HTML_DOCS appending.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/python-utils-r1.eclass | 25 +++++++++++++++++++++++++
7 1 file changed, 25 insertions(+)
8
9 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
10 index 647eb04344d2..f507b28ca90c 100644
11 --- a/eclass/python-utils-r1.eclass
12 +++ b/eclass/python-utils-r1.eclass
13 @@ -1344,6 +1344,31 @@ python_export_utf8_locale() {
14 return 0
15 }
16
17 +# @FUNCTION: build_sphinx
18 +# @USAGE: <directory>
19 +# @DESCRIPTION:
20 +# Build HTML documentation using dev-python/sphinx in the specified
21 +# <directory>. Takes care of disabling Intersphinx and appending
22 +# to HTML_DOCS.
23 +#
24 +# If <directory> is relative to the current directory, care needs
25 +# to be taken to run einstalldocs from the same directory
26 +# (usually ${S}).
27 +build_sphinx() {
28 + debug-print-function ${FUNCNAME} "${@}"
29 + [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: <directory>"
30 +
31 + local dir=${1}
32 +
33 + sed -i -e 's:^intersphinx_mapping:disabled_&:' \
34 + "${dir}"/conf.py || die
35 + # not all packages include the Makefile in pypi tarball
36 + sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
37 + "${dir}"/_build/html || die
38 +
39 + HTML_DOCS+=( "${dir}/_build/html/." )
40 +}
41 +
42 # -- python.eclass functions --
43
44 _python_check_dead_variables() {
45 --
46 2.24.0

Replies