sageWithDoc: make jupyter-sphinx available for docbuild

main
Mauricio Collares 2 years ago
parent e531fc20cd
commit 10b16ea5e7
  1. 10
      pkgs/applications/science/math/sage/default.nix
  2. 2
      pkgs/applications/science/math/sage/python-modules/sage-docbuild.nix
  3. 15
      pkgs/applications/science/math/sage/sage.nix
  4. 10
      pkgs/applications/science/math/sage/sagedoc.nix

@ -48,6 +48,12 @@ let
logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
};
jupyter-kernel-specs = pkgs.jupyter-kernel.create {
definitions = pkgs.jupyter-kernel.default // {
sagemath = jupyter-kernel-definition;
};
};
three = callPackage ./threejs-sage.nix { };
# A bash script setting various environment variables to tell sage where
@ -73,7 +79,7 @@ let
# The documentation for sage, building it takes a lot of ram.
sagedoc = callPackage ./sagedoc.nix {
inherit sage-with-env;
inherit python3 maxima;
inherit python3 maxima jupyter-kernel-specs;
};
# sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run.
@ -167,6 +173,6 @@ let
in
# A wrapper around sage that makes sure sage finds its docs (if they were build).
callPackage ./sage.nix {
inherit sage-tests sage-with-env sagedoc jupyter-kernel-definition;
inherit sage-tests sage-with-env sagedoc jupyter-kernel-specs;
inherit withDoc requireSageTests;
}

@ -2,6 +2,7 @@
, buildPythonPackage
, sage-src
, sphinx
, jupyter-sphinx
}:
buildPythonPackage rec {
@ -11,6 +12,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [
sphinx
jupyter-sphinx
];
preBuild = ''

@ -2,8 +2,7 @@
, makeWrapper
, sage-tests
, sage-with-env
, jupyter-kernel-definition
, jupyter-kernel
, jupyter-kernel-specs
, sagedoc
, withDoc
, requireSageTests
@ -12,14 +11,6 @@
# A wrapper that makes sure sage finds its docs (if they were build) and the
# jupyter kernel spec.
let
# generate kernel spec + default kernels
kernel-specs = jupyter-kernel.create {
definitions = jupyter-kernel.default // {
sagemath = jupyter-kernel-definition;
};
};
in
stdenv.mkDerivation rec {
version = src.version;
pname = "sage";
@ -43,7 +34,7 @@ stdenv.mkDerivation rec {
--set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
} \
--prefix JUPYTER_PATH : "${kernel-specs}"
--prefix JUPYTER_PATH : "${jupyter-kernel-specs}"
'';
doInstallCheck = withDoc;
@ -58,7 +49,7 @@ stdenv.mkDerivation rec {
quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
doc = sagedoc;
lib = sage-with-env.env.lib;
kernelspec = jupyter-kernel-definition;
kernelspec = jupyter-kernel-specs.definition.sagemath;
};
meta = with lib; {

@ -1,6 +1,7 @@
{ stdenv
, sage-with-env
, python3
, jupyter-kernel-specs
, maxima
, tachyon
, jmol
@ -59,10 +60,15 @@ stdenv.mkDerivation rec {
OUTPUT="$OUTPUT_DIR/options.txt"
${sage-with-env}/bin/sage -advanced > "$OUTPUT"
${sage-with-env}/bin/sage --docbuild \
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
export JUPYTER_PATH=${jupyter-kernel-specs}
# sage --docbuild unsets JUPYTER_PATH, so we call sage_docbuild directly
# https://trac.sagemath.org/ticket/33650#comment:32
${sage-with-env}/bin/sage --python3 -m sage_docbuild \
--mathjax \
--no-pdf-links \
all html
all html < /dev/null
'';
installPhase = ''

Loading…
Cancel
Save