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 |
(changes in PATCH 2) |
10 |
|
11 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
12 |
index 647eb04344d2..f507b28ca90c 100644 |
13 |
--- a/eclass/python-utils-r1.eclass |
14 |
+++ b/eclass/python-utils-r1.eclass |
15 |
@@ -1344,6 +1344,31 @@ python_export_utf8_locale() { |
16 |
return 0 |
17 |
} |
18 |
|
19 |
+# @FUNCTION: build_sphinx |
20 |
+# @USAGE: <directory> |
21 |
+# @DESCRIPTION: |
22 |
+# Build HTML documentation using dev-python/sphinx in the specified |
23 |
+# <directory>. Takes care of disabling Intersphinx and appending |
24 |
+# to HTML_DOCS. |
25 |
+# |
26 |
+# If <directory> is relative to the current directory, care needs |
27 |
+# to be taken to run einstalldocs from the same directory |
28 |
+# (usually ${S}). |
29 |
+build_sphinx() { |
30 |
+ debug-print-function ${FUNCNAME} "${@}" |
31 |
+ [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: <directory>" |
32 |
+ |
33 |
+ local dir=${1} |
34 |
+ |
35 |
+ sed -i -e 's:^intersphinx_mapping:disabled_&:' \ |
36 |
+ "${dir}"/conf.py || die |
37 |
+ # not all packages include the Makefile in pypi tarball |
38 |
+ sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \ |
39 |
+ "${dir}"/_build/html || die |
40 |
+ |
41 |
+ HTML_DOCS+=( "${dir}/_build/html/." ) |
42 |
+} |
43 |
+ |
44 |
# -- python.eclass functions -- |
45 |
|
46 |
_python_check_dead_variables() { |
47 |
-- |
48 |
2.24.0 |