Merge pull request #283322 from collares/sage-10.2

sage: 10.0 -> 10.2
This commit is contained in:
Mauricio Collares 2024-01-24 18:26:47 +01:00 committed by GitHub
commit 435535d968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 47 additions and 199 deletions

View File

@ -32,6 +32,7 @@ let
});
};
# matches src/sage/repl/ipython_kernel/install.py:kernel_spec
jupyter-kernel-definition = {
displayName = "SageMath ${sage-src.version}";
argv = [
@ -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";

View File

@ -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,

View File

@ -1,18 +0,0 @@
diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py
index aa153fd4cd..eebbe87aff 100644
--- a/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py
+++ b/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py
@@ -134,11 +134,11 @@ Sage example in ./graphique.tex, line 1120::
sage: t = srange(0, 5, 0.1); p = Graphics()
sage: for k in srange(0, 10, 0.15):
....: y = integrate.odeint(f, k, t)
- ....: p += line(zip(t, flatten(y)))
+ ....: p += line(zip(t, y.flatten()))
sage: t = srange(0, -5, -0.1); q = Graphics()
sage: for k in srange(0, 10, 0.15):
....: y = integrate.odeint(f, k, t)
- ....: q += line(zip(t, flatten(y)))
+ ....: q += line(zip(t, y.flatten()))
sage: y = var('y')
sage: v = plot_vector_field((1, -cos(x*y)), (x,-5,5), (y,-2,11))
sage: g = p + q + v; g.show()

View File

@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, sage-src
, cython
, cython_3
, jinja2
, pkgconfig # the python module, not the pkg-config alias
}:
@ -11,7 +11,7 @@ buildPythonPackage rec {
pname = "sage-setup";
src = sage-src;
nativeBuildInputs = [ cython ];
nativeBuildInputs = [ cython_3 ];
buildInputs = [ pkgconfig ];
propagatedBuildInputs = [ jinja2 ];

View File

@ -1,6 +1,7 @@
{ stdenv
, fetchFromGitHub
, fetchpatch
, fetchurl
}:
# This file is responsible for fetching the sage source and adding necessary patches.
@ -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.
@ -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;
@ -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"
'';
}

View File

@ -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"
@ -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
@ -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 = ''
@ -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
'';
}

View File

@ -48,7 +48,7 @@
, cvxopt
, cypari2
, cysignals
, cython
, cython_3
, fpylll
, gmpy2
, importlib-metadata
@ -152,7 +152,7 @@ buildPythonPackage rec {
cvxopt
cypari2
cysignals
cython
cython_3
fpylll
gmpy2
importlib-metadata
@ -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
sed -i 's/, <[^, ]*//' build/pkgs/*/install-requires.txt
for infile in src/*.m4; do
if [ -f "$infile" ]; then
outfile="src/$(basename $infile .m4)"
m4 "$infile" > "$outfile"
fi
done
cd src
cd build/pkgs/sagelib/src
'';
postInstall = ''

View File

@ -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";
@ -45,7 +45,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [
cysignals
cython
cython_3
];
checkPhase = ''

View File

@ -1,9 +1,8 @@
{ lib
, autoreconfHook
, fetchpatch
, fetchPypi
, buildPythonPackage
, cython
, cython_3
, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
}:
@ -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 = [
@ -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

View File

@ -1,11 +1,10 @@
{ lib
, fetchFromGitHub
, fetchpatch
, buildPythonPackage
# build-system
, cysignals
, cython
, cython_3
, pkgconfig
, setuptools
@ -31,21 +30,8 @@ buildPythonPackage rec {
hash = "sha256-M3ZnDL0Ui3UAa5Jn/Wr5pAHhghP7EAaQD/sx5QZ58ZQ=";
};
# temporarily revert to cython 0.29
patches = [
(fetchpatch {
url = "https://github.com/fplll/fpylll/commit/528243c6fa6491c8e9652b99bdf9758766273d66.diff";
revert = true;
sha256 = "sha256-IRppkESy0CRwARhxBAsZxP6JkTe0M91apG4CTSSYNUU=";
excludes = ["requirements.txt"];
})
];
postPatch = ''
substituteInPlace requirements.txt --replace "Cython>=3.0" "Cython"
'';
nativeBuildInputs = [
cython
cython_3
cysignals
pkgconfig
setuptools

View File

@ -1,7 +1,7 @@
{ lib
, fetchPypi
, buildPythonPackage
, cython
, cython_3
}:
buildPythonPackage rec {
@ -15,7 +15,7 @@ buildPythonPackage rec {
hash = "sha256-E4BcKuHAG3SJ+rXo6sk2FmK08sAkEuNlLuzkj/aVMWI=";
};
propagatedBuildInputs = [ cython ];
propagatedBuildInputs = [ cython_3 ];
pythonImportsCheck = [ "memory_allocator" ];

View File

@ -5,7 +5,7 @@
, mpfr
, libmpc
, ppl
, cython
, cython_3
, cysignals
, gmpy2
, sphinx
@ -33,7 +33,7 @@ buildPythonPackage rec {
];
propagatedBuildInputs = [
cython
cython_3
cysignals
gmpy2
];

View File

@ -2,7 +2,7 @@
, fetchPypi
, buildPythonPackage
, primecount
, cython
, cython_3
, cysignals
}:
@ -18,7 +18,7 @@ buildPythonPackage rec {
buildInputs = [ primecount ];
propagatedBuildInputs = [ cython cysignals ];
propagatedBuildInputs = [ cython_3 cysignals ];
# depends on pytest-cython for "pytest --doctest-cython"
doCheck = false;