···9292 sed -i \
9393 "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
9494 src/sage/env.py
9595-9696- # docbuilding expects a spkg index generated by the doc/bootstrap script (which
9797- # we don't run) to exist. the spkg list includes nix package names, but it's not
9898- # worth the hassle of running the bootstrap script, so just create a dummy index.
9999- touch src/doc/en/reference/spkg/index.rst
100100-101101- # the bootstrap script also generates installation instructions for
102102- # arch, debian, fedora, cygwin and homebrew using data from build/pkgs.
103103- # we don't run the bootstrap script, so disable including the generated
104104- # files. docbuilding fails otherwise.
105105- sed -i "/literalinclude/d" src/doc/en/installation/source.rst
10695 '';
1079610897 buildPhase = "# do nothing";
+21-6
pkgs/applications/science/math/sage/sagedoc.nix
···11111212 strictDeps = true;
13131414+ nativeBuildInputs = [
1515+ # for patchShebangs below
1616+ python3
1717+ ];
1818+1419 unpackPhase = ''
1520 export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
1621 export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
···2429 export HOME="$TMPDIR/sage_home"
2530 mkdir -p "$HOME"
26313232+ # run bootstrap script to generate Sage spkg docs, because unfortunately some unrelated doc
3333+ # pages link to them. it needs a few ugly (but self-contained) hacks for a standalone run.
3434+ cp -r "${src}/build" "$HOME"
3535+ chmod -R 755 "$HOME/build"
3636+ sed -i "/assert/d" "$HOME/build/sage_bootstrap/env.py"
3737+ sed -i "s|sage-bootstrap-python|python3|" "$HOME/build/bin/sage-package"
3838+ patchShebangs "$HOME/build/bin/sage-package"
3939+ pushd "$SAGE_DOC_SRC_OVERRIDE"
4040+ sed -i "s|OUTPUT_DIR=\"src/doc/|OUTPUT_DIR=\"$SAGE_DOC_SRC_OVERRIDE/|" bootstrap
4141+ PATH="$HOME/build/bin:$PATH" SAGE_ROOT="${src}" ./bootstrap
4242+ popd
4343+4444+ # adapted from src/doc/Makefile (doc-src target), which tries to call Sage from PATH
4545+ mkdir -p $SAGE_DOC_SRC_OVERRIDE/en/reference/repl
4646+ ${sage-with-env}/bin/sage -advanced > $SAGE_DOC_SRC_OVERRIDE/en/reference/repl/options.txt
4747+2748 # needed to link them in the sage docs using intersphinx
2849 export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
2929-3030- # adapted from src/doc/bootstrap (which we don't run)
3131- OUTPUT_DIR="$SAGE_DOC_SRC_OVERRIDE/en/reference/repl"
3232- mkdir -p "$OUTPUT_DIR"
3333- OUTPUT="$OUTPUT_DIR/options.txt"
3434- ${sage-with-env}/bin/sage -advanced > "$OUTPUT"
35503651 # jupyter-sphinx calls the sagemath jupyter kernel during docbuild
3752 export JUPYTER_PATH=${jupyter-kernel-specs}