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"; 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 { }; three = callPackage ./threejs-sage.nix { };
# A bash script setting various environment variables to tell sage where # 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. # The documentation for sage, building it takes a lot of ram.
sagedoc = callPackage ./sagedoc.nix { sagedoc = callPackage ./sagedoc.nix {
inherit sage-with-env; 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. # sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run.
@ -167,6 +173,6 @@ let
in in
# A wrapper around sage that makes sure sage finds its docs (if they were build). # A wrapper around sage that makes sure sage finds its docs (if they were build).
callPackage ./sage.nix { 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; inherit withDoc requireSageTests;
} }

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

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

@ -1,6 +1,7 @@
{ stdenv { stdenv
, sage-with-env , sage-with-env
, python3 , python3
, jupyter-kernel-specs
, maxima , maxima
, tachyon , tachyon
, jmol , jmol
@ -59,10 +60,15 @@ stdenv.mkDerivation rec {
OUTPUT="$OUTPUT_DIR/options.txt" OUTPUT="$OUTPUT_DIR/options.txt"
${sage-with-env}/bin/sage -advanced > "$OUTPUT" ${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 \ --mathjax \
--no-pdf-links \ --no-pdf-links \
all html all html < /dev/null
''; '';
installPhase = '' installPhase = ''

Loading…
Cancel
Save