1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
{ pkgs
, stdenv
, sage-src
, env-locations
, sage-with-env
, sagelib
, python2
, psutil
, future
, sphinx
, sagenb
, maxima-ecl
, networkx
, scipy
, sympy
, matplotlib
, pillow
, ipykernel
, jupyter_client
, tachyon
, jmol
, ipywidgets
, typing
, cddlib
, pybrial
}:
stdenv.mkDerivation rec {
version = sage-src.version;
name = "sagedoc-${version}";
# Building the documentation has many dependencies, because all documented
# modules are imported and because matplotlib is used to produce plots.
buildInputs = [
sagelib
python2
psutil
future
sphinx
sagenb
maxima-ecl
networkx
scipy
sympy
matplotlib
pillow
ipykernel
jupyter_client
tachyon
jmol
ipywidgets
typing
cddlib
pybrial
];
unpackPhase = ''
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
cp -r "${sage-src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
'';
buildPhase = ''
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
export HOME="$TMPDIR/sage_home"
mkdir -p "$HOME"
${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
'';
}
|