Skip to content

Commit

Permalink
Merge pull request #105615 from collares/sage-update
Browse files Browse the repository at this point in the history
sage: 8.9 -> 9.2
  • Loading branch information
timokau authored Dec 19, 2020
2 parents e52f705 + 8100c5a commit afead52
Show file tree
Hide file tree
Showing 36 changed files with 329 additions and 488 deletions.
4 changes: 2 additions & 2 deletions pkgs/applications/science/math/giac/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ assert (!blas.isILP64) && (!lapack.isILP64);

stdenv.mkDerivation rec {
pname = "giac${lib.optionalString enableGUI "-with-xcas"}";
version = "1.5.0-21"; # TODO try to remove preCheck phase on upgrade
version = "1.5.0-87"; # TODO try to remove preCheck phase on upgrade

src = fetchurl {
url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${version}.tar.gz";
sha256 = "1b9khiv0mk2xzw1rblm2jy6qsf8y6f9k7qy15sxpb21d72hzzbl2";
sha256 = "1d0h1yb7qvh9x7wwv9yrzmcp712f49w1iljkxp4y6g9pzsmg1mmv";
};

patches = stdenv.lib.optionals (!enableGUI) [
Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/science/math/maxima/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ stdenv.mkDerivation ({

enableParallelBuilding = true;

passthru = {
ecl = ecl;
};

meta = {
description = "Computer algebra system";
homepage = "http://maxima.sourceforge.net";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/nauty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
version = "27r1";
src = fetchurl {
url = "http://pallini.di.uniroma1.it/nauty${version}.tar.gz";
sha256 = "1nym0p2djws8ylkpr0kgpxfa6fxdlh46cmvz0gn5vd02jzgs0aww";
sha256 = "0xsfqfcknbd6g6wzpa5l7crmmk3bf3zjh37rhylq6b20dqcmvjkn";
};
outputs = [ "out" "dev" ];
configureFlags = [
Expand Down
3 changes: 2 additions & 1 deletion pkgs/applications/science/math/pari/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ stdenv.mkDerivation rec {
version = "2.11.4";

src = fetchurl {
url = "https://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz";
# Versions with current majorMinor values are at http://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz
url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.gz";
sha256 = "sha256-v8iPxPc1L0hA5uNSxy8DacvqikVAOxg0piafNwmXCxw=";
};

Expand Down
9 changes: 9 additions & 0 deletions pkgs/applications/science/math/pynac/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ stdenv
, fetchFromGitHub
, fetchurl
, autoreconfHook
, pkgconfig
, flint
Expand Down Expand Up @@ -33,6 +34,14 @@ stdenv.mkDerivation rec {
pkgconfig
];

patches = [
(fetchurl {
name = "py_ssize_t_clean.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/pynac/patches/py_ssize_t_clean.patch?h=9.2";
sha256 = "0l3gbg9hc4v671zf4w376krnk3wh8hj3649610nlvzzxckcryzab";
})
];

meta = with stdenv.lib; {
description = "Python is Not a CAS -- modified version of Ginac";
longDescription = ''
Expand Down
65 changes: 28 additions & 37 deletions pkgs/applications/science/math/sage/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,13 @@
let
inherit (pkgs) symlinkJoin callPackage nodePackages;

# https://trac.sagemath.org/ticket/15980 for tracking of python3 support
python = pkgs.python2.override {
python3 = pkgs.python3.override {
packageOverrides = self: super: {
# python packages that appear unmaintained and were not accepted into the nixpkgs
# tree because of that. These packages are only dependencies of the more-or-less
# deprecated sagenb. However sagenb is still a default dependency and the doctests
# depend on it.
# See https://github.com/NixOS/nixpkgs/pull/38787 for a discussion.
# The dependency on the sage notebook (and therefore these packages) will be
# removed in the future:
# https://trac.sagemath.org/ticket/25837
flask-oldsessions = self.callPackage ./flask-oldsessions.nix {};
flask-openid = self.callPackage ./flask-openid.nix {};
python-openid = self.callPackage ./python-openid.nix {};
sagenb = self.callPackage ./sagenb.nix {
mathjax = nodePackages.mathjax;
};

# Package with a cyclic dependency with sage
pybrial = self.callPackage ./pybrial.nix {};

# `sagelib`, i.e. all of sage except some wrappers and runtime dependencies
sagelib = self.callPackage ./sagelib.nix {
inherit flint ecl arb;
inherit flint arb;
inherit sage-src env-locations pynac singular;
ecl = maxima-ecl.ecl;
linbox = pkgs.linbox.override { withSage = true; };
pkg-config = pkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
};
Expand All @@ -59,31 +41,33 @@ let
# A bash script setting various environment variables to tell sage where
# the files its looking fore are located. Also see `sage-env`.
env-locations = callPackage ./env-locations.nix {
inherit pari_data ecl;
inherit pari_data;
inherit singular maxima-ecl;
cysignals = python.pkgs.cysignals;
ecl = maxima-ecl.ecl;
cysignals = python3.pkgs.cysignals;
three = nodePackages.three;
mathjax = nodePackages.mathjax;
};

# The shell file that gets sourced on every sage start. Will also source
# the env-locations file.
sage-env = callPackage ./sage-env.nix {
sagelib = python.pkgs.sagelib;
sagelib = python3.pkgs.sagelib;
inherit env-locations;
inherit python ecl singular palp flint pynac pythonEnv maxima-ecl;
inherit python3 singular palp flint pynac pythonEnv maxima-ecl;
ecl = maxima-ecl.ecl;
pkg-config = pkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
};

# The documentation for sage, building it takes a lot of ram.
sagedoc = callPackage ./sagedoc.nix {
inherit sage-with-env;
inherit python maxima-ecl;
inherit python3 maxima-ecl;
};

# sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run.
sage-with-env = callPackage ./sage-with-env.nix {
inherit pythonEnv;
inherit python3 pythonEnv;
inherit sage-env;
inherit pynac singular maxima-ecl;
pkg-config = pkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
Expand All @@ -100,10 +84,8 @@ let

sage-src = callPackage ./sage-src.nix {};

pythonRuntimeDeps = with python.pkgs; [
pythonRuntimeDeps = with python3.pkgs; [
sagelib
pybrial
sagenb
cvxopt
networkx
service-identity
Expand All @@ -116,11 +98,10 @@ let
ipywidgets
rpy2
sphinx
typing
pillow
];

pythonEnv = python.buildEnv.override {
pythonEnv = python3.buildEnv.override {
extraLibs = pythonRuntimeDeps;
ignoreCollisions = true;
} // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible
Expand All @@ -129,8 +110,21 @@ let

singular = pkgs.singular.override { inherit flint; };

# https://trac.sagemath.org/ticket/26625
maxima-ecl = pkgs.maxima-ecl;
maxima-ecl = pkgs.maxima-ecl.override {
ecl = pkgs.ecl.override {
# "echo syntax error | ecl > /dev/full 2>&1" segfaults in
# ECL. We apply a patch to fix it (write_error.patch), but it
# only works if threads are disabled. sage 9.2 tests this
# (src/sage/interfaces/tests.py) and ships ecl like so.
# https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/1#note_1657275
threadSupport = false;

# if we don't use the system boehmgc, sending a SIGINT to ecl
# can segfault if we it happens during memory allocation.
# src/sage/libs/ecl.pyx would intermittently fail in this case.
useBoehmgc = true;
};
};

# *not* to confuse with the python package "pynac"
pynac = pkgs.pynac.override { inherit singular flint; };
Expand Down Expand Up @@ -161,9 +155,6 @@ let
pari-seadata-small
];
};

# https://trac.sagemath.org/ticket/22191
ecl = pkgs.ecl_16_1_2;
in
# A wrapper around sage that makes sure sage finds its docs (if they were build).
callPackage ./sage.nix {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/sage/env-locations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ writeTextFile rec {
export JSMOL_DIR="${jmol}/share/jsmol"
export MATHJAX_DIR="${mathjax}/lib/node_modules/mathjax"
export THREEJS_DIR="${three}/lib/node_modules/three"
export SAGE_INCLUDE_DIRECTORIES="${cysignals}/lib/python2.7/site-packages"
export SAGE_INCLUDE_DIRECTORIES="${cysignals}/${cysignals.pythonModule.sitePackages}"
'';
}
36 changes: 0 additions & 36 deletions pkgs/applications/science/math/sage/flask-oldsessions.nix

This file was deleted.

28 changes: 0 additions & 28 deletions pkgs/applications/science/math/sage/flask-openid.nix

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 8218bd4fdeb4c92de8af0d3aabec55980fc4fb3d Mon Sep 17 00:00:00 2001
From f5ea42a7aaed7611fb55b65897b9fcf2b7bcf97e Mon Sep 17 00:00:00 2001
From: Timo Kaufmann <[email protected]>
Date: Sun, 21 Oct 2018 17:52:40 +0200
Subject: [PATCH] Only test py2/py3 optional tests when all of sage is tested

---
src/sage/doctest/control.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
src/sage/doctest/control.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
index bf18df8b2b..935c67abf7 100644
index 2d93841e50..6d156e29a1 100644
--- a/src/sage/doctest/control.py
+++ b/src/sage/doctest/control.py
@@ -362,7 +362,8 @@ class DocTestController(SageObject):
@@ -375,7 +375,8 @@ class DocTestController(SageObject):
if not optionaltag_regex.search(o):
raise ValueError('invalid optional tag {!r}'.format(o))

Expand All @@ -21,15 +21,6 @@ index bf18df8b2b..935c67abf7 100644

self.options = options

@@ -765,7 +766,7 @@ class DocTestController(SageObject):
sage: DC = DocTestController(DD, [dirname])
sage: DC.expand_files_into_sources()
sage: sorted(DC.sources[0].options.optional) # abs tol 1
- ['guava', 'magma', 'py2']
+ ['guava', 'magma']

We check that files are skipped appropriately::

--
2.18.1
2.28.0

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
diff --git a/src/sage/env.py b/src/sage/env.py
index 061b94f3f1..67cd091540 100644
index 1ddfc7cfb9..45033d6328 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -189,88 +189,13 @@ var('MAXIMA_FAS')
@@ -203,97 +203,13 @@ var('ARB_LIBRARY', 'arb')
var('SAGE_BANNER', '')
var('SAGE_IMPORTALL', 'yes')

-
-def _get_shared_lib_filename(libname, *additional_libnames):
- """
- Return the full path to a shared library file installed in the standard
- location for the system within the ``LIBDIR`` prefix (or
- ``$SAGE_LOCAL/lib`` in the case of manual build of Sage).
- Return the full path to a shared library file installed in
- ``$SAGE_LOCAL/lib`` or the directories associated with the
- Python sysconfig.
-
- This can also be passed more than one library name (e.g. for cases where
- some library may have multiple names depending on the platform) in which
Expand All @@ -25,7 +25,7 @@ index 061b94f3f1..67cd091540 100644
- For distributions like Debian that use a multiarch layout, we also try the
- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
-
- Returns ``None`` if the file does not exist.
- This returns ``None`` if the file does not exist.
-
- EXAMPLES::
-
Expand All @@ -48,11 +48,17 @@ index 061b94f3f1..67cd091540 100644
-
- for libname in (libname,) + additional_libnames:
- if sys.platform == 'cygwin':
- bindir = sysconfig.get_config_var('BINDIR')
- # Later down we take the last matching DLL found, so search
- # SAGE_LOCAL second so that it takes precedence
- bindirs = [
- sysconfig.get_config_var('BINDIR'),
- os.path.join(SAGE_LOCAL, 'bin')
- ]
- pats = ['cyg{}.dll'.format(libname), 'cyg{}-*.dll'.format(libname)]
- filenames = []
- for pat in pats:
- filenames += glob.glob(os.path.join(bindir, pat))
- for bindir in bindirs:
- for pat in pats:
- filenames += glob.glob(os.path.join(bindir, pat))
-
- # Note: This is not very robust, since if there are multi DLL
- # versions for the same library this just selects one more or less
Expand All @@ -66,10 +72,13 @@ index 061b94f3f1..67cd091540 100644
- else:
- ext = 'so'
-
- libdirs = [sysconfig.get_config_var('LIBDIR')]
- libdirs = [
- os.path.join(SAGE_LOCAL, 'lib'),
- sysconfig.get_config_var('LIBDIR')
- ]
- multilib = sysconfig.get_config_var('MULTILIB')
- if multilib:
- libdirs.insert(0, os.path.join(libdirs[0], multilib))
- libdirs.insert(1, os.path.join(libdirs[0], multilib))
-
- for libdir in libdirs:
- basename = 'lib{}.{}'.format(libname, ext)
Expand All @@ -89,7 +98,7 @@ index 061b94f3f1..67cd091540 100644

# locate libgap shared object
-GAP_SO= _get_shared_lib_filename('gap','')
+GAP_SO= '/default'
+GAP_SO = '/default'
var('GAP_SO', GAP_SO)

# post process
Loading

0 comments on commit afead52

Please sign in to comment.