···92 sed -i \
93 "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
94 src/sage/env.py
95-96- # docbuilding expects a spkg index generated by the doc/bootstrap script (which
97- # we don't run) to exist. the spkg list includes nix package names, but it's not
98- # worth the hassle of running the bootstrap script, so just create a dummy index.
99- touch src/doc/en/reference/spkg/index.rst
100-101- # the bootstrap script also generates installation instructions for
102- # arch, debian, fedora, cygwin and homebrew using data from build/pkgs.
103- # we don't run the bootstrap script, so disable including the generated
104- # files. docbuilding fails otherwise.
105- sed -i "/literalinclude/d" src/doc/en/installation/source.rst
106 '';
107108 buildPhase = "# do nothing";
···92 sed -i \
93 "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
94 src/sage/env.py
0000000000095 '';
9697 buildPhase = "# do nothing";
+21-6
pkgs/applications/science/math/sage/sagedoc.nix
···1112 strictDeps = true;
130000014 unpackPhase = ''
15 export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
16 export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
···24 export HOME="$TMPDIR/sage_home"
25 mkdir -p "$HOME"
26000000000000000027 # needed to link them in the sage docs using intersphinx
28 export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
29-30- # adapted from src/doc/bootstrap (which we don't run)
31- OUTPUT_DIR="$SAGE_DOC_SRC_OVERRIDE/en/reference/repl"
32- mkdir -p "$OUTPUT_DIR"
33- OUTPUT="$OUTPUT_DIR/options.txt"
34- ${sage-with-env}/bin/sage -advanced > "$OUTPUT"
3536 # jupyter-sphinx calls the sagemath jupyter kernel during docbuild
37 export JUPYTER_PATH=${jupyter-kernel-specs}
···1112 strictDeps = true;
1314+ nativeBuildInputs = [
15+ # for patchShebangs below
16+ python3
17+ ];
18+19 unpackPhase = ''
20 export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
21 export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
···29 export HOME="$TMPDIR/sage_home"
30 mkdir -p "$HOME"
3132+ # run bootstrap script to generate Sage spkg docs, because unfortunately some unrelated doc
33+ # pages link to them. it needs a few ugly (but self-contained) hacks for a standalone run.
34+ cp -r "${src}/build" "$HOME"
35+ chmod -R 755 "$HOME/build"
36+ sed -i "/assert/d" "$HOME/build/sage_bootstrap/env.py"
37+ sed -i "s|sage-bootstrap-python|python3|" "$HOME/build/bin/sage-package"
38+ patchShebangs "$HOME/build/bin/sage-package"
39+ pushd "$SAGE_DOC_SRC_OVERRIDE"
40+ sed -i "s|OUTPUT_DIR=\"src/doc/|OUTPUT_DIR=\"$SAGE_DOC_SRC_OVERRIDE/|" bootstrap
41+ PATH="$HOME/build/bin:$PATH" SAGE_ROOT="${src}" ./bootstrap
42+ popd
43+44+ # adapted from src/doc/Makefile (doc-src target), which tries to call Sage from PATH
45+ mkdir -p $SAGE_DOC_SRC_OVERRIDE/en/reference/repl
46+ ${sage-with-env}/bin/sage -advanced > $SAGE_DOC_SRC_OVERRIDE/en/reference/repl/options.txt
47+48 # needed to link them in the sage docs using intersphinx
49 export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
0000005051 # jupyter-sphinx calls the sagemath jupyter kernel during docbuild
52 export JUPYTER_PATH=${jupyter-kernel-specs}