2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv
|
2018-04-24 22:53:36 +01:00
|
|
|
, sage-with-env
|
2018-11-12 22:28:29 +00:00
|
|
|
, python
|
2018-04-24 22:53:36 +01:00
|
|
|
, maxima-ecl
|
|
|
|
, tachyon
|
|
|
|
, jmol
|
|
|
|
, cddlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-11-12 22:28:29 +00:00
|
|
|
version = src.version;
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "sagedoc";
|
2018-11-12 22:28:29 +00:00
|
|
|
src = sage-with-env.env.lib.src;
|
2018-04-24 22:53:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Building the documentation has many dependencies, because all documented
|
|
|
|
# modules are imported and because matplotlib is used to produce plots.
|
|
|
|
buildInputs = [
|
2018-11-12 22:28:29 +00:00
|
|
|
sage-with-env.env.lib
|
|
|
|
python
|
|
|
|
maxima-ecl
|
|
|
|
tachyon
|
|
|
|
jmol
|
|
|
|
cddlib
|
|
|
|
] ++ (with python.pkgs; [
|
2018-04-24 22:53:36 +01:00
|
|
|
psutil
|
|
|
|
future
|
|
|
|
sphinx
|
|
|
|
sagenb
|
|
|
|
scipy
|
|
|
|
sympy
|
|
|
|
matplotlib
|
|
|
|
pillow
|
2018-11-12 22:28:29 +00:00
|
|
|
networkx
|
2018-04-24 22:53:36 +01:00
|
|
|
ipykernel
|
|
|
|
ipywidgets
|
2018-11-12 22:28:29 +00:00
|
|
|
jupyter_client
|
2018-04-24 22:53:36 +01:00
|
|
|
typing
|
|
|
|
pybrial
|
2018-11-12 22:28:29 +00:00
|
|
|
]);
|
2018-04-24 22:53:36 +01:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
|
|
|
|
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
|
|
|
|
|
2018-11-12 22:28:29 +00:00
|
|
|
cp -r "${src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
|
2018-04-24 22:53:36 +01:00
|
|
|
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
|
|
|
|
export HOME="$TMPDIR/sage_home"
|
|
|
|
mkdir -p "$HOME"
|
|
|
|
|
2019-01-27 10:28:39 +00:00
|
|
|
# needed to link them in the sage docs using intersphinx
|
|
|
|
export PPLPY_DOCS=${python.pkgs.pplpy.doc}/share/doc/pplpy
|
|
|
|
|
2018-04-24 22:53:36 +01:00
|
|
|
${sage-with-env}/bin/sage -python -m sage_setup.docbuild \
|
|
|
|
--mathjax \
|
|
|
|
--no-pdf-links \
|
|
|
|
all html
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd "$SAGE_DOC_OVERRIDE"
|
|
|
|
|
|
|
|
mkdir -p "$out/share/doc/sage"
|
|
|
|
cp -r html "$out"/share/doc/sage
|
|
|
|
|
|
|
|
# Replace duplicated files by symlinks (Gentoo)
|
|
|
|
cd "$out"/share/doc/sage
|
|
|
|
mv html/en/_static{,.tmp}
|
|
|
|
for _dir in `find -name _static` ; do
|
|
|
|
rm -r $_dir
|
|
|
|
ln -s /share/doc/sage/html/en/_static $_dir
|
|
|
|
done
|
|
|
|
mv html/en/_static{.tmp,}
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
${sage-with-env}/bin/sage -t --optional=dochtml --all
|
|
|
|
'';
|
|
|
|
}
|