Merge staging-next into staging
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
, isPy3k
|
||||
, ensureNewerSourcesForZipFilesHook
|
||||
, findutils
|
||||
, installShellFiles
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -190,6 +191,6 @@ in rec {
|
||||
sphinxHook = callPackage ({ sphinx }:
|
||||
makeSetupHook {
|
||||
name = "python${python.pythonVersion}-sphinx-hook";
|
||||
deps = [ sphinx ];
|
||||
deps = [ sphinx installShellFiles ];
|
||||
} ./sphinx-hook.sh) {};
|
||||
}
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
# This hook automatically finds Sphinx documentation, builds it in html format
|
||||
# and installs it.
|
||||
#
|
||||
# This hook knows about several popular locations in which subdirectory
|
||||
# documentation may be, but in very unusual cases $sphinxRoot directory can be
|
||||
# set explicitly.
|
||||
#
|
||||
# Name of the directory relative to ${doc:-$out}/share/doc is normally also
|
||||
# deduced automatically, but can be overridden with $sphinxOutdir variable.
|
||||
#
|
||||
# Sphinx build system can depend on arbitrary amount of python modules, client
|
||||
# code is responsible for ensuring that all dependencies are present.
|
||||
# shellcheck shell=bash
|
||||
echo "Sourcing sphinx-hook"
|
||||
|
||||
declare -a __sphinxBuilders
|
||||
|
||||
buildSphinxPhase() {
|
||||
local __sphinxRoot="" o
|
||||
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"
|
||||
@@ -22,10 +16,10 @@ buildSphinxPhase() {
|
||||
fi
|
||||
__sphinxRoot=$sphinxRoot
|
||||
else
|
||||
for o in doc docs doc/source docs/source ; do
|
||||
if [[ -f "$o/conf.py" ]] ; then
|
||||
echo "Sphinx documentation found in $o"
|
||||
__sphinxRoot=$o
|
||||
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
|
||||
@@ -35,23 +29,44 @@ buildSphinxPhase() {
|
||||
echo 2>&1 "Sphinx documentation not found, use 'sphinxRoot' variable"
|
||||
exit 1
|
||||
fi
|
||||
sphinx-build -M html "${__sphinxRoot}" ".sphinx/html" -v
|
||||
|
||||
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
|
||||
|
||||
docdir="${doc:-$out}/share/doc/${sphinxOutdir:-$name}"
|
||||
mkdir -p "$docdir"
|
||||
for __builder in "${__sphinxBuilders[@]}"; do
|
||||
# divert output for man builder
|
||||
if [ "$__builder" == "man" ]; then
|
||||
installManPage .sphinx/man/man/*
|
||||
|
||||
cp -r .sphinx/html/html "$docdir/"
|
||||
rm -fr "${docdir}/html/_sources" "${docdir}/html/.buildinfo"
|
||||
else
|
||||
# shellcheck disable=2154
|
||||
docdir="${doc:-$out}/share/doc/${pname}"
|
||||
|
||||
mkdir -p "$docdir"
|
||||
|
||||
cp -r ".sphinx/${__builder}/${__builder}" "$docdir/"
|
||||
rm -fr "${docdir}/${__builder}/_sources" "${docdir}/${__builder}/.buildinfo"
|
||||
fi
|
||||
done
|
||||
|
||||
runHook postInstallSphinx
|
||||
}
|
||||
|
||||
preDistPhases+=" buildSphinxPhase"
|
||||
postPhases+=" installSphinxPhase"
|
||||
preDistPhases+=" buildSphinxPhase installSphinxPhase"
|
||||
|
||||
Reference in New Issue
Block a user