blob: ca67fa9beabf3a3a965113254d9eeec164a64bfe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# shellcheck shell=bash
echo "Sourcing sphinx-hook"
declare -a __sphinxBuilders
buildSphinxPhase() {
echo "Executing buildSphinxPhase"
local __sphinxRoot=""
runHook preBuildSphinx
if [[ -n "${sphinxRoot:-}" ]] ; then # explicit root
if ! [[ -f "${sphinxRoot}/conf.py" ]] ; then
echo 2>&1 "$sphinxRoot/conf.py: no such file"
exit 1
fi
__sphinxRoot=$sphinxRoot
else
for candidate in doc docs doc/source docs/source ; do
if [[ -f "$candidate/conf.py" ]] ; then
echo "Sphinx documentation found in $candidate"
__sphinxRoot=$candidate
break
fi
done
fi
if [[ -z "${__sphinxRoot}" ]] ; then
echo 2>&1 "Sphinx documentation not found, use 'sphinxRoot' variable"
exit 1
fi
if [ -n "${sphinxBuilders-}" ]; then
eval "__sphinxBuilders=($sphinxBuilders)"
else
__sphinxBuilders=(html)
fi
for __builder in "${__sphinxBuilders[@]}"; do
echo "Executing sphinx-build with ${__builder} builder"
sphinx-build -M "${__builder}" "${__sphinxRoot}" ".sphinx/${__builder}" -v
done
runHook postBuildSphinx
}
installSphinxPhase() {
echo "Executing installSphinxPhase"
local docdir=""
runHook preInstallSphinx
for __builder in "${__sphinxBuilders[@]}"; do
# divert output for man builder
if [ "$__builder" == "man" ]; then
installManPage .sphinx/man/man/*
else
# shellcheck disable=2154
docdir="${doc:-$out}/share/doc/${name}"
mkdir -p "$docdir"
cp -r ".sphinx/${__builder}/${__builder}" "$docdir/"
rm -fr "${docdir}/${__builder}/_sources" "${docdir}/${__builder}/.buildinfo"
fi
done
runHook postInstallSphinx
}
preDistPhases+=" buildSphinxPhase installSphinxPhase"
|