mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-23 05:35:50 +02:00
sageWithDoc: run src/doc/bootstrap script before docbuild
This commit is contained in:
parent
0edaaae3ff
commit
c13e4258f6
|
@ -92,17 +92,6 @@ stdenv.mkDerivation rec {
|
|||
sed -i \
|
||||
"s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
|
||||
src/sage/env.py
|
||||
|
||||
# docbuilding expects a spkg index generated by the doc/bootstrap script (which
|
||||
# we don't run) to exist. the spkg list includes nix package names, but it's not
|
||||
# worth the hassle of running the bootstrap script, so just create a dummy index.
|
||||
touch src/doc/en/reference/spkg/index.rst
|
||||
|
||||
# the bootstrap script also generates installation instructions for
|
||||
# arch, debian, fedora, cygwin and homebrew using data from build/pkgs.
|
||||
# we don't run the bootstrap script, so disable including the generated
|
||||
# files. docbuilding fails otherwise.
|
||||
sed -i "/literalinclude/d" src/doc/en/installation/source.rst
|
||||
'';
|
||||
|
||||
buildPhase = "# do nothing";
|
||||
|
|
|
@ -11,6 +11,11 @@ stdenv.mkDerivation rec {
|
|||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
# for patchShebangs below
|
||||
python3
|
||||
];
|
||||
|
||||
unpackPhase = ''
|
||||
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
|
||||
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
|
||||
|
@ -24,15 +29,25 @@ stdenv.mkDerivation rec {
|
|||
export HOME="$TMPDIR/sage_home"
|
||||
mkdir -p "$HOME"
|
||||
|
||||
# run bootstrap script to generate Sage spkg docs, because unfortunately some unrelated doc
|
||||
# pages link to them. it needs a few ugly (but self-contained) hacks for a standalone run.
|
||||
cp -r "${src}/build" "$HOME"
|
||||
chmod -R 755 "$HOME/build"
|
||||
sed -i "/assert/d" "$HOME/build/sage_bootstrap/env.py"
|
||||
sed -i "s|sage-bootstrap-python|python3|" "$HOME/build/bin/sage-package"
|
||||
patchShebangs "$HOME/build/bin/sage-package"
|
||||
pushd "$SAGE_DOC_SRC_OVERRIDE"
|
||||
sed -i "s|OUTPUT_DIR=\"src/doc/|OUTPUT_DIR=\"$SAGE_DOC_SRC_OVERRIDE/|" bootstrap
|
||||
PATH="$HOME/build/bin:$PATH" SAGE_ROOT="${src}" ./bootstrap
|
||||
popd
|
||||
|
||||
# adapted from src/doc/Makefile (doc-src target), which tries to call Sage from PATH
|
||||
mkdir -p $SAGE_DOC_SRC_OVERRIDE/en/reference/repl
|
||||
${sage-with-env}/bin/sage -advanced > $SAGE_DOC_SRC_OVERRIDE/en/reference/repl/options.txt
|
||||
|
||||
# needed to link them in the sage docs using intersphinx
|
||||
export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
|
||||
|
||||
# adapted from src/doc/bootstrap (which we don't run)
|
||||
OUTPUT_DIR="$SAGE_DOC_SRC_OVERRIDE/en/reference/repl"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
OUTPUT="$OUTPUT_DIR/options.txt"
|
||||
${sage-with-env}/bin/sage -advanced > "$OUTPUT"
|
||||
|
||||
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
|
||||
export JUPYTER_PATH=${jupyter-kernel-specs}
|
||||
|
||||
|
|
Loading…
Reference in a new issue