sageWithDoc: run src/doc/bootstrap script before docbuild

+21 -17
-11
pkgs/applications/science/math/sage/sage-src.nix
··· 92 92 sed -i \ 93 93 "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \ 94 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 95 ''; 107 96 108 97 buildPhase = "# do nothing";
+21 -6
pkgs/applications/science/math/sage/sagedoc.nix
··· 11 11 12 12 strictDeps = true; 13 13 14 + nativeBuildInputs = [ 15 + # for patchShebangs below 16 + python3 17 + ]; 18 + 14 19 unpackPhase = '' 15 20 export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage" 16 21 export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc" ··· 24 29 export HOME="$TMPDIR/sage_home" 25 30 mkdir -p "$HOME" 26 31 32 + # 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 + 27 48 # needed to link them in the sage docs using intersphinx 28 49 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" 35 50 36 51 # jupyter-sphinx calls the sagemath jupyter kernel during docbuild 37 52 export JUPYTER_PATH=${jupyter-kernel-specs}