Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/applications/science/math/sage/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let
});
};

# matches src/sage/repl/ipython_kernel/install.py:kernel_spec
jupyter-kernel-definition = {
displayName = "SageMath ${sage-src.version}";
argv = [
Expand All @@ -42,7 +43,7 @@ let
"-f"
"{connection_file}"
];
language = "sagemath";
language = "sage";
# just one 16x16 logo is available
logo32 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py
index 0070705f78..ac19818f1b 100644
index 2deb533f7f..663ff2cd13 100644
--- a/src/sage/graphs/generic_graph.py
+++ b/src/sage/graphs/generic_graph.py
@@ -6699,12 +6699,6 @@ class GenericGraph(GenericGraph_pyx):
@@ -6953,12 +6953,6 @@ class GenericGraph(GenericGraph_pyx):
sage: G = DiGraph(d6, format='dig6')
sage: G.edge_connectivity()
5
- sage: G.edge_disjoint_spanning_trees(5) # long time
- sage: G.edge_disjoint_spanning_trees(5) # long time # needs sage.numerical.mip
- [Digraph on 28 vertices,
- Digraph on 28 vertices,
- Digraph on 28 vertices,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, sage-src
, cython
, cython_3
, jinja2
, pkgconfig # the python module, not the pkg-config alias
}:
Expand All @@ -11,7 +11,7 @@ buildPythonPackage rec {
pname = "sage-setup";
src = sage-src;

nativeBuildInputs = [ cython ];
nativeBuildInputs = [ cython_3 ];
buildInputs = [ pkgconfig ];
propagatedBuildInputs = [ jinja2 ];

Expand Down
113 changes: 18 additions & 95 deletions pkgs/applications/science/math/sage/sage-src.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ stdenv
, fetchFromGitHub
, fetchpatch
, fetchurl
}:

# This file is responsible for fetching the sage source and adding necessary patches.
Expand All @@ -9,14 +10,23 @@
# all get the same sources with the same patches applied.

stdenv.mkDerivation rec {
version = "10.0";
version = "10.2";
pname = "sage-src";

src = fetchFromGitHub {
owner = "sagemath";
repo = "sage";
rev = version;
sha256 = "sha256-zN/Lo/GBCjYGemuaYpgG3laufN8te3wPjXMQ+Me9zgY=";
sha256 = "sha256-VXnPdJhtw5Y/anecrVpevJDCyBVfnjksyuuZslNipm4=";
};

# contains essential files (e.g., setup.cfg) generated by the bootstrap script.
# TODO: investigate https://github.com/sagemath/sage/pull/35950
configure-src = fetchurl {
# the hash below is the tagged commit's _parent_. it can also be found by looking for
# the "configure" asset at https://github.com/sagemath/sage/releases/tag/${version}
url = "mirror://sageupstream/configure/configure-b2813506039143e6f0abe859ab67a343abf72c2e.tar.gz";
sha256 = "sha256-a1v0XyoKI+zO6Sjm8DzEwItRHbIgRDbpj4UfwVH+/hw=";
};

# Patches needed because of particularities of nix or the way this is packaged.
Expand Down Expand Up @@ -52,99 +62,6 @@ stdenv.mkDerivation rec {
# should come from or be proposed to upstream. This list will probably never
# be empty since dependencies update all the time.
packageUpgradePatches = [
# https://github.com/sagemath/sage/pull/35584, landed in 10.1.beta1
(fetchpatch {
name = "networkx-3.1-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/be0aab74fd7e399e146988ef27260d2837baebae.diff";
sha256 = "sha256-xBGrylNaiF7CpfmX9/4lTioP2LSYKoRCkKlKSGZuv9U=";
})

# https://github.com/sagemath/sage/pull/35612, landed in 10.1.beta1
(fetchpatch {
name = "linbox-1.7-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/35cbd2f2a2c4c355455d39b1424f05ea0aa4349b.diff";
sha256 = "sha256-/TpvIQZUqmbUuz6wvp3ni9oRir5LBA2FKDJcmnHI1r4=";
})

# https://github.com/sagemath/sage/pull/35619, landed in 10.1.beta1
(fetchpatch {
name = "maxima-5.46.0-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/4ddf9328e7598284d4bc03cd2ed890f0be6b6399.diff";
sha256 = "sha256-f6YaZiLSj+E0LJMsMZHDt6vecWffSAuUHYVkegBEhno=";
})

# https://github.com/sagemath/sage/pull/35635, landed in 10.1.beta1
(fetchpatch {
name = "sympy-1.12-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/1a73b3bbbfa0f4a297e05d49305070e1ed5ae598.diff";
sha256 = "sha256-k8Oam+EiRcfXC7qCdLacCx+7vpUAw2K1wsjKcQbeGb4=";
})

# https://github.com/sagemath/sage/pull/35826, landed in 10.1.beta5
(fetchpatch {
name = "numpy-1.25.0-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/ecfe06b8f1fe729b07e885f0de55244467e5c137.diff";
sha256 = "sha256-G0xhl+LyNdDYPzRqSHK3fHaepcIzpuwmqRiussraDf0=";
})

# https://github.com/sagemath/sage/pull/35826#issuecomment-1658569891
./patches/numpy-1.25-deprecation.patch

# https://github.com/sagemath/sage/pull/35842, landed in 10.1.beta5
(fetchpatch {
name = "scipy-1.11-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/90ece168c3c61508baa36659b0027b7dd8b43add.diff";
sha256 = "sha256-Y5TmuJcUJR+veb2AuSVODGs+xkVV+pTM8fWTm4q+NDs=";
})

# https://github.com/sagemath/sage/pull/35825, landed in 10.1.beta6
(fetchpatch {
name = "singular-4.3.2p2-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/1a1b49f814cdf4c4c8d0ac8930610f3fef6af5b0.diff";
sha256 = "sha256-GqMgoi0tsP7zcCcPumhdsbvhPB6fgw1ufx6gHlc6iSc=";
})

# https://github.com/sagemath/sage/pull/36006, landed in 10.2.beta2
(fetchpatch {
name = "gmp-6.3-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/5e841de46c3baa99cd1145b36ff9163e9340a55c.diff";
sha256 = "sha256-fJPDryLtGBQz9qHDiCkBwjiW2lN6v7HiHgxY7CTeHcs=";
})

# https://github.com/sagemath/sage/pull/36279, landed in 10.2.beta4
(fetchpatch {
name = "matplotlib-3.8-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/0fcf88935908440930c5f79202155aca4ad57518.diff";
sha256 = "sha256-mvqAHaTCXsxPv901L8HSTnrfghfXYdq0wfLoP/cYQZI=";
})

# https://github.com/sagemath/sage/pull/35658, landed in 10.1.beta2
(fetchpatch {
name = "sphinx-7-upgrade.patch";
url = "https://github.com/sagemath/sage/commit/cacd9a89b5c4fdcf84a8dd2b7d5bdc10cc78109a.diff";
sha256 = "sha256-qJvliTJjR3XBc5pH6Q0jtm8c4bhtZcTcF3O04Ro1uaU=";
})

# https://github.com/sagemath/sage/pull/36296, landed in 10.2.beta4
(fetchpatch {
name = "duplicate-args-region_plot.patch";
url = "https://github.com/sagemath/sage/commit/461727b453712550a2c5dc0ae11933523255aaed.diff";
sha256 = "sha256-mC8084VQoUBk4hocALF+Y9Cwb38Zt360eldi/SSjna8=";
})

# https://github.com/sagemath/sage/pull/36218, landed in 10.2.beta3
(fetchpatch {
name = "sageenv-disable-file-validation.patch";
url = "https://github.com/sagemath/sage/commit/31a764f4a9ec54d3ea970aa9514a088c4e603ebd.diff";
sha256 = "sha256-NhYUTTmYlyjss3eS8HZXP8U11TElQY0cv6KW4wBOaJY=";
})

# https://github.com/sagemath/sage/pull/36235, landed in 10.2.beta3
(fetchpatch {
name = "ecl-23.9.9.patch";
url = "https://github.com/sagemath/sage/commit/b6b50a80e9660c002d069019f5b8f04e9324a423.diff";
sha256 = "sha256-nF+5oKad1VYms6Dxr1t9/V0XBkoMfhy0KCY/ZPddrm0=";
})
];

patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
Expand All @@ -158,11 +75,17 @@ stdenv.mkDerivation rec {
sed -i \
"s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
src/sage/env.py

# sage --docbuild unsets JUPYTER_PATH, which breaks our docbuilding
# https://trac.sagemath.org/ticket/33650#comment:32
sed -i "/export JUPYTER_PATH/d" src/bin/sage
'';

buildPhase = "# do nothing";

installPhase = ''
cp -r . "$out"
tar xkzf ${configure-src} -C "$out"
rm "$out/configure"
'';
}
25 changes: 3 additions & 22 deletions pkgs/applications/science/math/sage/sagedoc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ stdenv.mkDerivation rec {

strictDeps = true;

nativeBuildInputs = [
# for patchShebangs below
python3
];

unpackPhase = ''
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
Expand All @@ -29,18 +24,6 @@ stdenv.mkDerivation rec {
export HOME="$TMPDIR/sage_home"
mkdir -p "$HOME"

# run bootstrap script to generate Sage spkg docs, because unfortunately some unrelated doc
# pages link to them. it needs a few ugly (but self-contained) hacks for a standalone run.
cp -r "${src}/build" "$HOME"
chmod -R 755 "$HOME/build"
sed -i "/assert/d" "$HOME/build/sage_bootstrap/env.py"
sed -i "s|sage-bootstrap-python|python3|" "$HOME/build/bin/sage-package"
patchShebangs "$HOME/build/bin/sage-package"
pushd "$SAGE_DOC_SRC_OVERRIDE"
sed -i "s|OUTPUT_DIR=\"src/doc/|OUTPUT_DIR=\"$SAGE_DOC_SRC_OVERRIDE/|" bootstrap
PATH="$HOME/build/bin:$PATH" SAGE_ROOT="${src}" ./bootstrap
popd

# adapted from src/doc/Makefile (doc-src target), which tries to call Sage from PATH
mkdir -p $SAGE_DOC_SRC_OVERRIDE/en/reference/repl
${sage-with-env}/bin/sage -advanced > $SAGE_DOC_SRC_OVERRIDE/en/reference/repl/options.txt
Expand All @@ -51,12 +34,10 @@ stdenv.mkDerivation rec {
# 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 \
${sage-with-env}/bin/sage --docbuild \
--mathjax \
--no-pdf-links \
all html < /dev/null
all html
'';

installPhase = ''
Expand All @@ -80,7 +61,7 @@ stdenv.mkDerivation rec {
# sagemath_doc_html tests assume sage tests are being run, so we
# compromise: we run standard tests, but only on files containing
# relevant tests. as of Sage 9.6, there are only 4 such files.
grep -PRl "#.*optional.*sagemath_doc_html" ${src}/src/sage{,_docbuild} | \
grep -PRl "#.*(optional|needs).*sagemath_doc_html" ${src}/src/sage{,_docbuild} | \
xargs ${sage-with-env}/bin/sage -t --optional=sage,sagemath_doc_html
'';
}
24 changes: 4 additions & 20 deletions pkgs/applications/science/math/sage/sagelib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
, cvxopt
, cypari2
, cysignals
, cython
, cython_3
, fpylll
, gmpy2
, importlib-metadata
Expand Down Expand Up @@ -152,7 +152,7 @@ buildPythonPackage rec {
cvxopt
cypari2
cysignals
cython
cython_3
fpylll
gmpy2
importlib-metadata
Expand Down Expand Up @@ -202,29 +202,13 @@ buildPythonPackage rec {
mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
mkdir -p "var/lib/sage/installed"

cd build/pkgs/sagelib

# some files, like Pipfile, pyproject.toml, requirements.txt and setup.cfg
# are generated by the bootstrap script using m4. these can fetch data from
# build/pkgs, either directly or via sage-get-system-packages.
sed -i '/sage_conf/d' src/setup.cfg.m4
sed -i '/sage_conf/d' src/requirements.txt.m4

# version lower bounds are useful, but upper bounds are a hassle because
# Sage tests already catch any relevant API breakage.
# according to the discussion at https://trac.sagemath.org/ticket/33520,
# upper bounds will be less noisy starting from Sage 9.6.
sed -i 's/==0.5.1/>=0.5.1/' ../ptyprocess/install-requires.txt
sed -i 's/, <[^, ]*//' ../*/install-requires.txt

for infile in src/*.m4; do
if [ -f "$infile" ]; then
outfile="src/$(basename $infile .m4)"
m4 "$infile" > "$outfile"
fi
done
sed -i 's/, <[^, ]*//' build/pkgs/*/install-requires.txt

cd src
cd build/pkgs/sagelib/src
'';

postInstall = ''
Expand Down
10 changes: 5 additions & 5 deletions pkgs/development/python-modules/cypari2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
, fetchPypi
, pari
, gmp
, cython
, cython_3
, cysignals
}:

buildPythonPackage rec {
pname = "cypari2";
# upgrade may break sage, please test the sage build or ping @timokau on upgrade
version = "2.1.3";
version = "2.1.4";
format = "setuptools";

src = fetchPypi {
inherit pname version;
sha256 = "17beb467d3cb39fffec3227c468f0dd8db8a09129faeb95a6bb4c84b2b6c6683";
sha256 = "sha256-76SkTZb2k8sRVtof1vzMEw2vz5wZr0GFz3cL9E0A2/w=";
};

patches = [
# patch to avoid some segfaults in sage's totallyreal.pyx test.
# (https://trac.sagemath.org/ticket/27267). depends on Cython patch.
# (https://trac.sagemath.org/ticket/27267).
(fetchpatch {
name = "use-trashcan-for-gen.patch";
url = "https://raw.githubusercontent.com/sagemath/sage/b6ea17ef8e4d652de0a85047bac8d41e90b25555/build/pkgs/cypari/patches/trashcan.patch";
Expand All @@ -45,7 +45,7 @@ buildPythonPackage rec {

propagatedBuildInputs = [
cysignals
cython
cython_3
];

checkPhase = ''
Expand Down
13 changes: 2 additions & 11 deletions pkgs/development/python-modules/cysignals/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{ lib
, autoreconfHook
, fetchpatch
, fetchPypi
, buildPythonPackage
, cython
, cython_3
, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
}:

Expand All @@ -19,14 +18,6 @@ buildPythonPackage rec {
hash = "sha256-Dx4yHlWgf5AchqNqHkSX9v+d/nAGgdATCjjDbk6yOMM=";
};

patches = [
# https://github.com/sagemath/cysignals/pull/193
(fetchpatch {
url = "https://github.com/sagemath/cysignals/commit/474179c87ab0ff562fdfd2471b02797e4bdd3148.diff";
sha256 = "sha256-qEAmf4kU+QDI/JPFNjQMZIjMBk8dnaLmOpagIBMsh7w=";
})
];

# explicit check:
# build/src/cysignals/implementation.c:27:2: error: #error "cysignals must be compiled without _FORTIFY_SOURCE"
hardeningDisable = [
Expand All @@ -43,7 +34,7 @@ buildPythonPackage rec {
'';

propagatedBuildInputs = [
cython
cython_3
] ++ lib.optionals pariSupport [
# When cysignals is built with pari, including cysignals into the
# buildInputs of another python package will cause cython to link against
Expand Down
Loading