Gentoo Archives: gentoo-dev

From: Anna <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/2] docs.eclass: allow multiple documentation builders
Date: Thu, 10 Nov 2022 11:38:31
Message-Id: Y2zir/kLWMYT3gcU@sysrq.in
In Reply to: [gentoo-dev] [PATCH 1/2] docs.eclass: allow multiple documentation builders by Andrew Ammerlaan
1 On 2022-11-10 12:29, Andrew Ammerlaan wrote:
2 > diff --git a/eclass/docs.eclass b/eclass/docs.eclass
3 > index 611485c227f..f7a82939a53 100644
4 > --- a/eclass/docs.eclass
5 > +++ b/eclass/docs.eclass
6 > @@ -207,16 +207,15 @@ sphinx_deps() {
7 > }
8 >
9 > # @FUNCTION: sphinx_compile
10 > -# @INTERNAL
11 > # @DESCRIPTION:
12 > # Calls sphinx to build docs.
13 > -#
14 > -# If you overwrite python_compile_all do not call
15 > -# this function, call docs_compile instead
16 > sphinx_compile() {
17 > debug-print-function ${FUNCNAME}
18 > use doc || return
19 >
20 > + : ${DOCS_DIR:="${S}"}
21 > + : ${DOCS_OUTDIR:="${S}/_build/html/sphinx"}
22 > +
23
24 Could it be local?
25
26 > local confpy=${DOCS_DIR}/conf.py
27 > [[ -f ${confpy} ]] ||
28 > die "${FUNCNAME}: ${confpy} not found, DOCS_DIR=${DOCS_DIR} call wrong"
29 > @@ -236,6 +235,12 @@ sphinx_compile() {
30 > # not all packages include the Makefile in pypi tarball
31 > sphinx-build -b html -d "${DOCS_OUTDIR}"/_build/doctrees "${DOCS_DIR}" \
32 > "${DOCS_OUTDIR}" || die "${FUNCNAME}: sphinx-build failed"
33 > +
34 > + HTML_DOCS+=( "${DOCS_OUTDIR}" )
35 > +
36 > + # We don't need these any more, unset them in case we want to call a
37 > + # second documentation builder.
38 > + unset DOCS_DIR DOCS_OUTDIR
39 > }
40 >
41 > # @FUNCTION: mkdocs_deps
42 > @@ -263,16 +268,15 @@ mkdocs_deps() {
43 > }
44 >
45 > # @FUNCTION: mkdocs_compile
46 > -# @INTERNAL
47 > # @DESCRIPTION:
48 > # Calls mkdocs to build docs.
49 > -#
50 > -# If you overwrite python_compile_all do not call
51 > -# this function, call docs_compile instead
52 > mkdocs_compile() {
53 > debug-print-function ${FUNCNAME}
54 > use doc || return
55 >
56 > + : ${DOCS_DIR:="${S}"}
57 > + : ${DOCS_OUTDIR:="${S}/_build/html/mkdocs"}
58 > +
59
60 Ditto.
61
62 > local mkdocsyml=${DOCS_DIR}/mkdocs.yml
63 > [[ -f ${mkdocsyml} ]] ||
64 > die "${FUNCNAME}: ${mkdocsyml} not found, DOCS_DIR=${DOCS_DIR} wrong"
65 > @@ -285,6 +289,12 @@ mkdocs_compile() {
66 > # mkdocs currently has no option to disable this
67 > # and portage complains: "Colliding files found by ecompress"
68 > rm "${DOCS_OUTDIR}"/*.gz || die
69 > +
70 > + HTML_DOCS+=( "${DOCS_OUTDIR}" )
71 > +
72 > + # We don't need these any more, unset them in case we want to call a
73 > + # second documentation builder.
74 > + unset DOCS_DIR DOCS_OUTDIR
75 > }
76 >
77 > # @FUNCTION: doxygen_deps
78 > @@ -299,14 +309,16 @@ doxygen_deps() {
79 > }
80 >
81 > # @FUNCTION: doxygen_compile
82 > -# @INTERNAL
83 > # @DESCRIPTION:
84 > # Calls doxygen to build docs.
85 > doxygen_compile() {
86 > debug-print-function ${FUNCNAME}
87 > use doc || return
88 >
89 > + # This is the default name of the config file, upstream can change it.
90 > : ${DOCS_CONFIG_NAME:="Doxyfile"}
91 > + : ${DOCS_DIR:="${S}"}
92 > + : ${DOCS_OUTDIR:="${S}/_build/html/doxygen"}
93
94 Ditto.
95
96 > local doxyfile=${DOCS_DIR}/${DOCS_CONFIG_NAME}
97 > [[ -f ${doxyfile} ]] ||
98 > @@ -318,6 +330,12 @@ doxygen_compile() {
99 > pushd "${DOCS_DIR}" || die
100 > (cat "${DOCS_CONFIG_NAME}" ; echo "HTML_OUTPUT=${DOCS_OUTDIR}") |
101 > doxygen - || die "${FUNCNAME}: doxygen failed"
102 > popd || die
103 > +
104 > + HTML_DOCS+=( "${DOCS_OUTDIR}" )
105 > +
106 > + # We don't need these any more, unset them in case we want to call a
107 > + # second documentation builder.
108 > + unset DOCS_DIR DOCS_OUTDIR DOCS_CONFIG_NAME
109 > }
110 >
111 > # @FUNCTION: docs_compile
112 > @@ -343,16 +361,8 @@ docs_compile() {
113 > debug-print-function ${FUNCNAME}
114 > use doc || return
115 >
116 > - # Set a sensible default as DOCS_DIR
117 > - : ${DOCS_DIR:="${S}"}
118 > -
119 > - # Where to put the compiled files?
120 > - : ${DOCS_OUTDIR:="${S}/_build/html"}
121 > -
122 > ${DOCS_BUILDER}_compile
123 >
124 > - HTML_DOCS+=( "${DOCS_OUTDIR}/." )
125 > -
126 > # we need to ensure successful return in case we're called last,
127 > # otherwise Portage may wrongly assume sourcing failed
128 > return 0
129 >
130 >
131 > diff --git a/net-libs/xrootd/xrootd-5.5.0.ebuild
132 > b/net-libs/xrootd/xrootd-5.5.0.ebuild
133 > index 53f8a65ef85..3acd41d1cb2 100644
134 > --- a/net-libs/xrootd/xrootd-5.5.0.ebuild
135 > +++ b/net-libs/xrootd/xrootd-5.5.0.ebuild
136 > @@ -88,12 +91,8 @@ src_configure() {
137 >
138 > src_compile() {
139 > cmake_src_compile
140 > - docs_compile
141 > -
142 > - # secondary documentation for python bindings
143 > - if use python && use doc; then
144 > - emake -C bindings/python/docs html
145 > - fi
146 > + doxygen_compile
147 > + use python && DOCS_DIR="${S}/bindings/python/docs/source" sphinx_compile
148 > }
149 >
150 > src_install() {
151 > @@ -121,11 +120,6 @@ src_install() {
152 > if use python; then
153 > python_optimize "${D}/$(python_get_sitedir)"
154 >
155 > - if use doc; then
156 > - docinto python
157 > - docompress -x "/usr/share/doc/${PF}/python/html"
158 > - dodoc -r bindings/python/docs/build/html
159 > - fi
160 > if use examples; then
161 > docinto python
162 > dodoc -r bindings/python/examples
163 >

Replies

Subject Author
Re: [gentoo-dev] [PATCH 1/2] docs.eclass: allow multiple documentation builders Andrew Ammerlaan <andrewammerlaan@g.o>