git.iko.soy/typeable/nixpkgs
on master help sign in
sage: 8.1 -> 8.2, use system packages
commit17e6b391eb6b524331bce29c01467dc055c8543b authorTimo Kaufmann <timokau@zoho.com> dateTue 24 Apr 2018, 23:53 (9 years ago) parent84d89a1
37 files changed+2693−411
pkgs/applications/science/math/sage/README.md+117 pkgs/applications/science/math/sage/default.nix+222−221 pkgs/applications/science/math/sage/env-locations.nix+46 pkgs/applications/science/math/sage/env.patch−22 pkgs/applications/science/math/sage/fetch-mirrors.sh−11 pkgs/applications/science/math/sage/flask-oldsessions.nix+36 pkgs/applications/science/math/sage/flask-openid.nix+28 pkgs/applications/science/math/sage/openblas-pc.nix+18 pkgs/applications/science/math/sage/patchSageShebangs.sh−51 pkgs/applications/science/math/sage/patches/dochtml-optional.patch+127 pkgs/applications/science/math/sage/patches/eclib-regulator-precision.patch+98 pkgs/applications/science/math/sage/patches/matplotlib-normed-deprecated.patch+12 pkgs/applications/science/math/sage/patches/maxima-5.41.0-doctests.patch+48 pkgs/applications/science/math/sage/patches/numpy-1.14.3.patch+812 pkgs/applications/science/math/sage/patches/pari-stackwarn.patch+20 pkgs/applications/science/math/sage/patches/python-5755-hotpatch.patch+28 pkgs/applications/science/math/sage/patches/python3-syntax-without-write.patch+40 pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch+14 pkgs/applications/science/math/sage/patches/sagenb-sphinx-1.7.patch+31 pkgs/applications/science/math/sage/patches/sphinx-1.7.patch+62 pkgs/applications/science/math/sage/patches/zn_poly_version.patch+13 pkgs/applications/science/math/sage/pybrial.nix+29 pkgs/applications/science/math/sage/python-openid.nix+42 pkgs/applications/science/math/sage/sage-env.nix+162 pkgs/applications/science/math/sage/sage-src.nix+197 pkgs/applications/science/math/sage/sage-with-env.nix+129 pkgs/applications/science/math/sage/sage-wrapper.nix+41 pkgs/applications/science/math/sage/sage.nix+32 pkgs/applications/science/math/sage/sagedoc.nix+97 pkgs/applications/science/math/sage/sagelib.nix+139 pkgs/applications/science/math/sage/sagenb.nix+49 pkgs/applications/science/math/sage/shebangs.patch−36 pkgs/applications/science/math/sage/spkg-giac.patch−20 pkgs/applications/science/math/sage/spkg-git.patch−18 pkgs/applications/science/math/sage/spkg-python.patch−13 pkgs/applications/science/math/sage/spkg-singular.patch−18 pkgs/top-level/all-packages.nix+4−1
pkgs/applications/science/math/sage/README.mdnew file+117
@@ -0,0 +1,117 @@
1+# Sage on nixos
2+
3+Sage is a pretty complex package that depends on many other complex packages and patches some of those. As a result, the sage nix package is also quite complex.
4+
5+Don't feel discouraged to fix, simplify or improve things though. Here's a quick overview over the functions of the individual files:
6+
7+- `sage-src.nix`
8+ Downloads the source code and applies patches. This makes sure that all the other files work with the same sage source. If you want to apply a patch to sage or update sage to a new version, this is the place to do it.
9+
10+- `env-locations.nix`
11+ Creates a bash file that sets a bunch of environment variables telling sage where to find various packages and files. The definitions of those environment variables can be found in the sage source in the `src/env.py` file. This bash file needs to be sourced before sage is started (done in `sage-env.nix` and `sagedoc.nix`).
12+
13+- `sage-env.nix`
14+ Sets all environment variables sage needs to run. This includes the package locations defined in `env-locations.nix` as well as the location of sage itself and its various subdirectories.
15+
16+- `sagelib.nix`
17+ Defines the main sage package (without setting the necessary environments or running any tests).
18+
19+- `sage-with-env.nix`
20+ Wraps sage in the necessary environment.
21+
22+- `sage.nix`
23+ Runs sages doctests.
24+
25+- `sage-wrapper.nix`
26+ Optionally tells sage where do find the docs.
27+
28+- `sagedoc.nix`
29+ Builds and tests the sage html documentation. Can be used for offline documentation viewing as well as the sage `browse_sage_doc` and `search_doc` functions.
30+
31+- `sagenb.nix`
32+ The (semi deprecated) sage notebook.
33+
34+- `default.nix`
35+ Introduces necessary overrides, defines new packages and ties everything together (returning the `sage` package).
36+
37+- `flask-oldsessions.nix`, `flask-openid.nix`, `python-openid.nix`
38+ These are python packages that were rejected from the main nixpkgs tree because they appear unmaintained. They are needed for the (semi-deprecated) sage notebook. Since that notebook is still needed to run the sage doctests, these packages are included but not exposed to the rest of nixpkgs.
39+
40+- `pybrial.nix`
41+ pybrial is a dependency of sage. However, pybrial itself also has sage as a dependency. Because of that circular dependency, pybrial is hidden from the rest of nixpkgs (just as the flask packages and python-openid.
42+
43+- `openblas-pc.nix`
44+ This creates a `.pc` file to be read by `pkg-config` that allows openblas to take on different roles, like `cblas` or `lapack`.
45+
46+## The sage build is broken
47+
48+First you should find out which change to nixpkgs is at fault (if you don't already know). You can use `git-bisect` for that (see the manpage).
49+
50+If the build broke as a result of a package update, try those solutions in order:
51+
52+- search the [sage trac](https://trac.sagemath.org/) for keywords like "Upgrade <package>". Maybe somebody has already proposed a patch that fixes the issue. You can then add a `fetchpatch` to `sage-src.nix`.
53+
54+- check if [gentoo](https://github.com/cschwan/sage-on-gentoo/tree/master/sci-mathematics/sage), [debian](https://salsa.debian.org/science-team/sagemath/tree/master/debian) or [arch linux](https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/sagemath) already solved the problem. You can then again add a `fetchpatch` to `sage-src.nix`. If applicable you should also [propose the patch upstream](#proposing-a-sage-patch).
55+
56+- fix the problem yourself. First clone the sagemath source and then check out the sage version you want to patch:
57+
58+```
59+[user@localhost ~]$ git clone git://github.com/sagemath/sage.git
60+[user@localhost ~]$ cd sage
61+[user@localhost sage]$ git checkout 8.2 # substitute the relevant version here
62+```
63+
64+Then make the needed changes and generate a patch with `git diff`:
65+
66+```
67+[user@localhost ~]$ <make changes>
68+[user@localhost ~]$ git diff -u > /path/to/nixpkgs/pkgs/applications/science/math/sage/patches/name-of-patch.patch
69+```
70+
71+Now just add the patch to `sage-src.nix` and test your changes. If they fix the problem, [propose them upstream](#proposing-a-sage-patch) and add a link to the trac ticket.
72+
73+- pin the package version in `default.nix` and add a note that explains why that is necessary.
74+
75+
76+## Proposing a sage patch
77+
78+You can [login the sage trac using GitHub](https://trac.sagemath.org/login). Your username will then be `gh-<your-github-name>`. The only other way is to request a trac account via email. After that refer to [git the hard way](http://doc.sagemath.org/html/en/developer/manual_git.html#chapter-manual-git) in the sage documentation. The "easy way" requires a non-GitHub account (requested via email) and a special tool. The "hard way" is really not all that hard if you're a bit familiar with git.
79+
80+Here's the gist, assuming you want to use ssh key authentication. First, [add your public ssh key](https://trac.sagemath.org/prefs/sshkeys). Then:
81+
82+```
83+[user@localhost ~]$ git clone git://github.com/sagemath/sage.git
84+[user@localhost ~]$ cd sage
85+[user@localhost sage]$ git remote add trac git@trac.sagemath.org:sage.git -t master
86+[user@localhost sage]$ git checkout -b u/gh-<your-github-username>/<your-branch-name> develop
87+[user@localhost sage]$ <make changes>
88+[user@localhost sage]$ git add .
89+[user@localhost sage]$ git commit
90+[user@localhost sage]$ git show # review your changes
91+[user@localhost sage]$ git push --set-upstream trac u/gh-<your-github-username>/<your-branch-name>
92+```
93+
94+You now created a branch on the trac server (you *must* follow the naming scheme as you only have push access to branches with the `u/gh-<your-github-username>/` prefix).
95+Now you can [create a new trac ticket](https://trac.sagemath.org/newticket).
96+- Write a description of the change
97+- set the type and component as appropriate
98+- write your real name in the "Authors" field
99+- write `u/gh-<your-github-username>/<your-branch-name>` in the "Branch" field
100+- click "Create ticket"
101+- click "Modify" on the top right of your ticket (for some reason you can only change the ticket status after you have created it)
102+- set the ticket status from `new` to `needs_review`
103+- click "Save changes"
104+
105+Refer to sages [Developer's Guide](http://doc.sagemath.org/html/en/developer/index.html) for further details.
106+
107+## I want to update sage
108+
109+You'll need to change the `version` field in `sage-src.nix`. Afterwards just try to build and let nix tell you which patches no longer apply (hopefully because they were adopted upstream). Remove those.
110+
111+Hopefully the build will succeed now. If it doesn't and the problem is obvious, fix it as described in [The sage build is broken](#the-sage-build-is-broken).
112+If the problem is not obvious, you can try to first update sage to an intermediate version (remember that you can also set the `version` field to any git revision of sage) and locate the sage commit that introduced the issue. You can even use `git-bisect` for that (it will only be a bit tricky to keep track of which patches to apply). Hopefully after that the issue will be obvious.
113+
114+## Well, that didn't help!
115+
116+If you couldn't fix the problem, create a GitHub issue on the nixpkgs repo and ping @timokau (or whoever is listed in the `maintainers` list of the sage package).
117+Describe what you did and why it didn't work. Afterwards it would be great if you help the next guy out and improve this documentation!
pkgs/applications/science/math/sage/default.nix+222−221
@@ -1,230 +1,231 @@
1−# TODO
2−# - consider writing a script to convert spkgs to nix packages, similar to vim
3−# or cabal2nix. This would allow a more efficient and "cleaner" build, greater
4−# flexibility and the possibility to select which dependencies to add and which
5−# to remove. It would also allow to use system packages for some dependencies
6−# and recompile others (optimized for the system) without recompiling everything.
7−# - add optdeps:
8−# - imagemagick
9−# - texlive full for documentation
10−# - ...
11−# - further seperate build outputs. Also maybe run `make doc`.
12−# Configure flags like --bindir and --libdir oculd also be used for that, see
13−# ./configure --help`.
14−
15−# Other resources:
16−# - https://wiki.debian.org/DebianScience/Sage
17−# - https://github.com/cschwan/sage-on-gentoo
18−# - https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/sagemath
19−
20−{ stdenv
21−, bash
22−, fetchurl
23−, perl
24−, gfortran6
25−, python
26−, autoreconfHook
27−, gettext
28−, which
29−, texlive
30−, texinfo
31−, hevea
32−, buildDocs ? false
33−, optimize ? false # optimize sage to the current system (obviously impure)
1+{ nixpkgs
2+, withDoc ? false
343}:
354
36−stdenv.mkDerivation rec {
37− version = "8.1";
38− name = "sage-${version}";
39−
40− # Modified version of patchShebangs that patches to the sage-internal version if possible
41− # and falls back to the system version if not.
42− patchSageShebangs = ./patchSageShebangs.sh;
43− src = fetchurl {
44− # Note that the source is *not* fetched from github, since that doesn't
45− # the upstream folder with all the source tarballs of the spkgs.
46− # If those are not present they are fetched at build time, which breaks
47− # when building in a sandbox (and probably only works if you install the
48− # latest sage version).
49− urls = [
50− "http://mirrors.mit.edu/sage/src/sage-${version}.tar.gz"
51− "ftp://ftp.fu-berlin.de/unix/misc/sage/src/sage-${version}.tar.gz"
52− "http://sagemath.polytechnic.edu.na/src/sage-${version}.tar.gz"
53− "ftp://ftp.sun.ac.za/pub/mirrors/www.sagemath.org/src/sage-${version}.tar.gz"
54− "http://sagemath.mirror.ac.za/src/sage-${version}.tar.gz"
55− "https://ftp.leg.uct.ac.za/pub/packages/sage/src/sage-${version}.tar.gz"
56− "http://mirror.ufs.ac.za/sagemath/src/sage-${version}.tar.gz"
57− "https://mirrors-usa.go-parts.com/sage/sagemath/src/sage-${version}.tar.gz"
58− "http://www.cecm.sfu.ca/sage/src/sage-${version}.tar.gz"
59− "http://files.sagemath.org/src/sage-${version}.tar.gz"
60− "https://mirrors.xmission.com/sage/src/sage-${version}.tar.gz"
61− "http://sagemath.c3sl.ufpr.br/src/sage-${version}.tar.gz"
62− "http://linorg.usp.br/sage/src/sage-${version}.tar.gz"
63− "http://mirror.hust.edu.cn/sagemath/src/sage-${version}.tar.gz"
64− "https://ftp.iitm.ac.in/sage/src/sage-${version}.tar.gz"
65− "http://ftp.kaist.ac.kr/sage/src/sage-${version}.tar.gz"
66− "https://ftp.riken.jp/sagemath/src/sage-${version}.tar.gz"
67− "https://mirrors.tuna.tsinghua.edu.cn/sagemath/src/sage-${version}.tar.gz"
68− "https://mirrors.ustc.edu.cn/sagemath/src/sage-${version}.tar.gz"
69− "http://ftp.tsukuba.wide.ad.jp/software/sage/src/sage-${version}.tar.gz"
70− "https://ftp.yz.yamagata-u.ac.jp/pub/math/sage/src/sage-${version}.tar.gz"
71− "https://mirror.yandex.ru/mirrors/sage.math.washington.edu/src/sage-${version}.tar.gz"
72− "https://mirror.aarnet.edu.au/pub/sage/src/sage-${version}.tar.gz"
73− "https://sage.mirror.garr.it/mirrors/sage/src/sage-${version}.tar.gz"
74− "https://www.mirrorservice.org/sites/www.sagemath.org/src/sage-${version}.tar.gz"
75− "http://mirror.switch.ch/mirror/sagemath/src/sage-${version}.tar.gz"
76− "https://mirrors.up.pt/pub/sage/src/sage-${version}.tar.gz"
77− "http://www-ftp.lip6.fr/pub/math/sagemath/src/sage-${version}.tar.gz"
78− "http://ftp.ntua.gr/pub/sagemath/src/sage-${version}.tar.gz"
79− ];
80− sha256 = "1cpcs1mr0yii64s152xmxyd450bfzjb22jjj0zh9y3n6g9alzpyq";
5+let
6+ inherit (nixpkgs) fetchpatch fetchurl symlinkJoin fetchFromGitHub callPackage nodePackages_8_x;
7+
8+ # https://trac.sagemath.org/ticket/15980 for tracking of python3 support
9+ python = nixpkgs.python2.override {
10+ packageOverrides = self: super: {
11+ cypari2 = super.cypari2.override { inherit pari; };
12+
13+ cysignals = super.cysignals.override { inherit pari; };
14+
15+ cvxopt = super.cvxopt.override { inherit glpk; };
16+
17+ # https://github.com/sagemath/sagenb/issues/437
18+ flask-babel = super.flask-babel.overridePythonAttrs (attrs: rec {
19+ version = "0.9";
20+ src = attrs.src.override {
21+ inherit version;
22+ sha256 = "0k7vk4k54y55ma0nx2k5s0phfqbriwslhy5shh3b0d046q7ibzaa";
23+ };
24+ doCheck = false;
25+ });
26+
27+ # python packages that appear unmaintained and were not accepted into the nixpkgs
28+ # tree because of that. These packages are only dependencies of the more-or-less
29+ # deprecated sagenb. However sagenb is still a default dependency and the doctests
30+ # depend on it.
31+ # See https://github.com/NixOS/nixpkgs/pull/38787 for a discussion.
32+ flask-oldsessions = self.callPackage ./flask-oldsessions.nix {};
33+ flask-openid = self.callPackage ./flask-openid.nix {};
34+ python-openid = self.callPackage ./python-openid.nix {};
35+
36+ pybrial = self.callPackage ./pybrial.nix {};
37+
38+ sagelib = self.callPackage ./sagelib.nix {
39+ inherit flint ecl pari glpk eclib;
40+ inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
41+ linbox = nixpkgs.linbox.override { withSage = true; };
42+ # tracking: https://trac.sagemath.org/ticket/24927
43+ arb = nixpkgs.arb.overrideAttrs (attrs: rec {
44+ name = "arb-${version}";
45+ version = "2.12.0";
46+ doCheck = false; # https://github.com/fredrik-johansson/arb/issues/194
47+ src = fetchFromGitHub {
48+ owner = "fredrik-johansson";
49+ repo = attrs.pname;
50+ rev = version;
51+ sha256 = "18bwxlcbqb70cj7l9x6w1h4yghrqfhmbhdby373q8vdrdfx58niq";
52+ };
53+ });
54+ };
55+
56+ sagenb = self.callPackage ./sagenb.nix {
57+ mathjax = nodePackages_8_x.mathjax;
58+ };
59+
60+ sagedoc = self.callPackage ./sagedoc.nix {
61+ inherit sage-src;
62+ };
63+
64+ env-locations = self.callPackage ./env-locations.nix {
65+ inherit pari_data ecl pari;
66+ inherit singular;
67+ three = nodePackages_8_x.three;
68+ mathjax = nodePackages_8_x.mathjax;
69+ };
70+
71+ sage-env = self.callPackage ./sage-env.nix {
72+ inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv;
73+ pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
74+ };
75+
76+ sage-with-env = self.callPackage ./sage-with-env.nix {
77+ inherit pari eclib pythonEnv;
78+ inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
79+ pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
80+ three = nodePackages_8_x.three;
81+ };
82+
83+ sage = self.callPackage ./sage.nix { };
84+
85+ sage-wrapper = self.callPackage ./sage-wrapper.nix {
86+ inherit sage-src withDoc;
87+ };
88+ };
8189 };
8290
83− postPatch = ''
84− substituteAllInPlace src/bin/sage-env
85− bash=${bash} substituteAllInPlace build/bin/sage-spkg
86− '';
87−
88− installPhase = ''
89− # Sage installs during first `make`, `make install` is no-op and just takes time.
90− '';
91−
92− outputs = [ "out" ] ++ stdenv.lib.optionals (buildDocs) [ "doc" ];
93−
94− buildInputs = [
95− bash # needed for the build
96− perl # needed for the build
97− python # needed for the build
98− gfortran6 # needed to build giac, openblas
99− autoreconfHook # needed to configure sage with prefix
100− gettext # needed to build the singular spkg
101− which # needed in configure of mpir
102− texinfo # needed to build maxima
103− ] ++ stdenv.lib.optionals(buildDocs) [
104− hevea # needed to build the docs of the giac spkg
105− (texlive.combine { inherit (texlive)
106− scheme-basic
107− collection-pstricks # needed by giac
108− times # font needed by giac
109− stmaryrd # needed by giac
110− babel-greek # optional for giac, otherwise throws a bunch of latex command not founds
111− ;
112− })
113− ];
114−
115− nativeBuildInputs = [ gfortran6 perl which ];
116−
117− patches = [
118− # fix usages of /bin/rm
119− ./spkg-singular.patch
120− # help python find the crypt library
121− # patches python3 and indirectly python2, since those installation files are symlinked
122− ./spkg-python.patch
123− # fix usages of /usr/bin/perl
124− ./spkg-git.patch
125− # fix usages of /bin/cp and add necessary argument to function call
126− ./spkg-giac.patch
127− # environment
128− ./env.patch
129− # adjust wrapper shebang and patch shebangs after each spkg build
130− ./shebangs.patch
91+ openblas-blas-pc = callPackage ./openblas-pc.nix { name = "blas"; };
92+ openblas-cblas-pc = callPackage ./openblas-pc.nix { name = "cblas"; };
93+ openblas-lapack-pc = callPackage ./openblas-pc.nix { name = "lapack"; };
94+
95+ sage-src = callPackage ./sage-src.nix {};
96+
97+ pythonRuntimeDeps = with python.pkgs; [
98+ sagelib
99+ pybrial
100+ sagenb
101+ cvxopt
102+ networkx
103+ service-identity
104+ psutil
105+ sympy
106+ fpylll
107+ matplotlib
108+ scipy
109+ ipywidgets
110+ rpy2
111+ sphinx
112+ typing
113+ pillow
131114 ];
132115
133− enableParallelBuilding = true;
116+ pythonEnv = python.buildEnv.override {
117+ extraLibs = pythonRuntimeDeps;
118+ ignoreCollisions = true;
119+ } // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible
120+
121+ # needs to be rWrapper, standard "R" doesn't include default packages
122+ rWrapper = nixpkgs.rWrapper.override {
123+ # https://trac.sagemath.org/ticket/25674
124+ R = nixpkgs.R.overrideAttrs (attrs: rec {
125+ name = "R-3.4.4";
126+ src = fetchurl {
127+ url = "http://cran.r-project.org/src/base/R-3/${name}.tar.gz";
128+ sha256 = "0dq3jsnwsb5j3fhl0wi3p5ycv8avf8s5j1y4ap3d2mkjmcppvsdk";
129+ };
130+ });
131+ };
134132
135− hardeningDisable = [
136− "format" # needed to build palp, for lines like `printf(ctime(&_NFL->TIME))`
137− # TODO could be patched with `sed s|printf(ctime(\(.*\)))|%s... or fixed upstream
138− ];
133+ # update causes issues
134+ # https://groups.google.com/forum/#!topic/sage-packaging/cS3v05Q0zso
135+ # https://trac.sagemath.org/ticket/24735
136+ singular = nixpkgs.singular.overrideAttrs (oldAttrs: {
137+ name = "singular-4.1.0p3";
138+ src = fetchurl {
139+ url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-1-0/singular-4.1.0p3.tar.gz";
140+ sha256 = "105zs3zk46b1cps403ap9423rl48824ap5gyrdgmg8fma34680a4";
141+ };
142+ });
143+
144+ # *not* to confuse with the python package "pynac"
145+ # https://trac.sagemath.org/ticket/24838 (depends on arb update)
146+ pynac = (nixpkgs.pynac.override { inherit singular; }).overrideAttrs (oldAttrs: rec {
147+ name = "pynac-0.7.16";
148+ src = fetchFromGitHub {
149+ owner = "pynac";
150+ repo = "pynac";
151+ rev = name;
152+ sha256 = "106an189sg4rpgzfrmy3699271vg4ddazw9wvh51wx7qnm1v86ik";
153+ };
154+ });
155+
156+ eclib = nixpkgs.eclib.override { inherit pari; };
157+
158+ # With openblas (64 bit), the tests fail the same way as when sage is build with
159+ # openblas instead of openblasCompat. Apparently other packages somehow use flints
160+ # blas when it is available. Alternative would be to override flint to use
161+ # openblasCompat.
162+ flint = nixpkgs.flint.override { withBlas = false; };
163+
164+ # Multiple palp dimensions need to be available and sage expects them all to be
165+ # in the same folder.
166+ palp = symlinkJoin {
167+ name = "palp-${nixpkgs.palp.version}";
168+ paths = [
169+ (nixpkgs.palp.override { dimensions = 4; doSymlink = false; })
170+ (nixpkgs.palp.override { dimensions = 5; doSymlink = false; })
171+ (nixpkgs.palp.override { dimensions = 6; doSymlink = true; })
172+ (nixpkgs.palp.override { dimensions = 11; doSymlink = false; })
173+ ];
174+ };
139175
140− configureFlags = stdenv.lib.optionals(buildDocs) [ "--docdir=$(doc)" ];
141− preConfigure = ''
142− export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
143−
144− export HOME=/tmp/sage-home
145− export SAGE_ROOT="$PWD"
146− export SAGE_SRC="$PWD"
147−
148− mkdir -p "$HOME"
149− mkdir -p "$out"
150−
151− # we need to keep the source around
152− dir="$PWD"
153− cd ..
154− mv "$dir" "$out/sage-root"
155−
156− export SAGE_SPKG_INSTALL_DOCS='no'
157− cd "$out/sage-root" # build in target dir, since `make` is also `make install`
158− ''
159− + stdenv.lib.optionalString (buildDocs) ''
160− mkdir -p "$doc"
161− export SAGE_DOC="$doc"
162− export SAGE_DOCBUILD_OPTS="--no-pdf-links -k"
163− ''
164− + stdenv.lib.optionalString (!optimize) ''
165− export SAGE_FAT_BINARY=yes
166− '';
167−
168− buildFlags = if (buildDocs) then "doc" else "build";
169−
170− # for reference: http://doc.sagemath.org/html/en/installation/source.html
171− preBuild = ''
172− # symlink python to make sure the shebangs are patched to the sage path
173− # while still being able to use python before building it
174− # (this is important because otherwise sage will try to install python
175− # packages globally later on)
176− ln -s "${python}/bin/python2" $out/bin/python2
177− ln -s "$out/bin/python2" $out/bin/python
178− touch $out/bin/python3
179− bash $patchSageShebangs .
180− '';
181−
182− postBuild = ''
183− # Clean up
184− rm -r "$out/sage-root/upstream" # don't keep the sources of all the spkgs
185− rm -rf "$out/sage-root/src/build"
186− rm -rf "$out/sage-root/src/autom4te.cache"
187− rm -rf "$out/sage-root/src/config"
188− rm -rf "$out/sage-root/src/m4"
189− rm -rf "$out/sage-root/.git"
190− rm -r "$out/sage-root/logs"
191− rm -r "$out"/lib/python*/test
192− # Fix dependency cycle between out and doc
193− rm -f "$out/sage-root/config.log"
194− rm -f "$out/sage-root/config.status"
195− rm -f "$out/sage-root/build/make/Makefile-auto"
196− rm -f "$out/sage-home/.sage/gap/libgap-workspace-"*
197− # Make sure unnessessary packages don't end up in the build closure
198− find "$out" \
199− -iname 'config.log' \
200− -delete \
201− -or -iname 'Makefile' \
202− -delete
203− rm -f "$out/lib/R/etc/Renviron"
204− # Make sure all shebangs are properly patched
205− bash $patchSageShebangs $out
206− '';
207−
208− # TODO there are some doctest failures, which seem harmless.
209− # We should figure out a way to fix the failures or ignore only those tests.
210− doCheck = false;
211−
212− checkTarget = "ptestalllong"; # all long tests in parallell
213− preCheck = ''
214− export SAGE_TIMEOUT=0 # no timeout
215− export SAGE_TIMEOUT_LONG=0 # no timeout
216− '';
217−
218− meta = {
219− homepage = http://www.sagemath.org;
220− description = "A free open source mathematics software system";
221− # taken from the homepage
222− longDescription = ''
223− SageMath is a free open-source mathematics software system licensed under the GPL. It builds on top of many existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their combined power through a common, Python-based language or directly via interfaces or wrappers.
224− Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.
225− '';
226− license = stdenv.lib.licenses.gpl2Plus;
227− platforms = ["x86_64-linux" "i686-linux"];
228− maintainers = with stdenv.lib.maintainers; [ timokau ];
176+ # Sage expects those in the same directory.
177+ pari_data = symlinkJoin {
178+ name = "pari_data";
179+ paths = with nixpkgs; [
180+ pari-galdata
181+ pari-seadata-small
182+ ];
229183 };
230−}
184+
185+ # https://trac.sagemath.org/ticket/22191
186+ ecl = nixpkgs.ecl_16_1_2;
187+
188+ # sage currently uses an unreleased version of pari
189+ pari = (nixpkgs.pari.override { withThread = false; }).overrideAttrs (attrs: rec {
190+ version = "2.10-1280-g88fb5b3"; # on update remove pari-stackwarn patch from `sage-src.nix`
191+ src = fetchurl {
192+ url = "mirror://sageupstream/pari/pari-${version}.tar.gz";
193+ sha256 = "19gbsm8jqq3hraanbmsvzkbh88iwlqbckzbnga3y76r7k42akn7m";
194+ };
195+ });
196+
197+ # https://trac.sagemath.org/ticket/24824
198+ glpk = nixpkgs.glpk.overrideAttrs (attrs: rec {
199+ version = "4.63";
200+ name = "glpk-${version}";
201+ src = fetchurl {
202+ url = "mirror://gnu/glpk/${name}.tar.gz";
203+ sha256 = "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci";
204+ };
205+ patches = (attrs.patches or []) ++ [
206+ # Alternatively patch sage with debians
207+ # https://sources.debian.org/data/main/s/sagemath/8.1-7/debian/patches/t-version-glpk-4.60-extra-hack-fixes.patch
208+ # The header of that debian patch contains a good description of the issue. The gist of it:
209+ # > If GLPK in Sage causes one error, and this is caught by Sage and recovered from, then
210+ # > later (because upstream GLPK does not clear the "error" flag) Sage will append
211+ # > all subsequent terminal output of GLPK into the error_message string but not
212+ # > actually forward it to the user's terminal. This breaks some doctests.
213+ (fetchpatch {
214+ name = "error_recovery.patch";
215+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/error_recovery.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
216+ sha256 = "0z99z9gd31apb6x5n5n26411qzx0ma3s6dnznc4x61x86bhq31qf";
217+ })
218+
219+ # Allow setting a exact verbosity level (OFF|ERR|ON|ALL|DBG)
220+ (fetchpatch {
221+ name = "exact_verbosity.patch";
222+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/glp_exact_verbosity.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
223+ sha256 = "15gm5i2alqla3m463i1qq6jx6c0ns6lip7njvbhp37pgxg4s9hx8";
224+ })
225+ ];
226+ });
227+in
228+ python.pkgs.sage-wrapper // {
229+ doc = python.pkgs.sagedoc;
230+ lib = python.pkgs.sagelib;
231+ }
pkgs/applications/science/math/sage/env-locations.nixnew file+46
@@ -0,0 +1,46 @@
1+{ stdenv
2+, writeTextFile
3+, pari_data
4+, pari
5+, singular
6+, maxima-ecl
7+, conway_polynomials
8+, graphs
9+, elliptic_curves
10+, polytopes_db
11+, gap-libgap-compatible
12+, ecl
13+, combinatorial_designs
14+, jmol
15+, mathjax
16+, three
17+, cysignals
18+}:
19+
20+writeTextFile rec {
21+ name = "sage-env-locations";
22+ destination = "/${name}";
23+ text = ''
24+ export GP_DATA_DIR="${pari_data}/share/pari"
25+ export PARI_DATA_DIR="${pari_data}"
26+ export GPHELP="${pari}/bin/gphelp"
27+ export GPDOCDIR="${pari}/share/pari/doc"
28+ export SINGULARPATH='${singular}/share/singular'
29+ export SINGULAR_SO='${singular}/lib/libSingular.so'
30+ export SINGULAR_EXECUTABLE='${singular}/bin/Singular'
31+ export MAXIMA_FAS='${maxima-ecl}/lib/maxima/${maxima-ecl.version}/binary-ecl/maxima.fas'
32+ export MAXIMA_PREFIX="${maxima-ecl}"
33+ export CONWAY_POLYNOMIALS_DATA_DIR='${conway_polynomials}/share/conway_polynomials'
34+ export GRAPHS_DATA_DIR='${graphs}/share/graphs'
35+ export ELLCURVE_DATA_DIR='${elliptic_curves}/share/ellcurves'
36+ export POLYTOPE_DATA_DIR='${polytopes_db}/share/reflexive_polytopes'
37+ export GAP_ROOT_DIR='${gap-libgap-compatible}/share/gap/build-dir'
38+ export ECLDIR='${ecl}/lib/ecl-${ecl.version}/'
39+ export COMBINATORIAL_DESIGN_DATA_DIR="${combinatorial_designs}/share/combinatorial_designs"
40+ export CREMONA_MINI_DATA_DIR="${elliptic_curves}/share/cremona"
41+ export JMOL_DIR="${jmol}"
42+ export MATHJAX_DIR="${mathjax}/lib/node_modules/mathjax"
43+ export THREEJS_DIR="${three}/lib/node_modules/three"
44+ export SAGE_INCLUDE_DIRECTORIES="${cysignals}/lib/python2.7/site-packages"
45+ '';
46+}
pkgs/applications/science/math/sage/env.patchdeleted−22
@@ -1,22 +0,0 @@
1−diff --git a/src/bin/sage-env b/src/bin/sage-env
2−index ead308f861..ed8db9f9b7 100644
3−--- a/src/bin/sage-env
4−+++ b/src/bin/sage-env
5−@@ -111,6 +111,8 @@ resolvelinks() {
6− }
7−
8−
9−+SAGE_ROOT="@out@/sage-root"
10−+
11− # New value for SAGE_ROOT: either SAGE_ROOT (if given)
12− # or a guessed value based on pwd.
13− if [ -n "$SAGE_ROOT" ]; then
14−@@ -185,6 +187,8 @@ fi
15− export SAGE_ENV_SOURCED=$SAGE_ENV_VERSION
16−
17− export SAGE_ROOT="$NEW_SAGE_ROOT"
18−+export SAGE_LOCAL='@out@/'
19−+export PYTHONPATH="@out@/lib/python2.7/site-packages:$PYTHONPATH"
20−
21−
22− # sage-env must know where the Sage's script files are.
pkgs/applications/science/math/sage/fetch-mirrors.shdeleted−11
@@ -1,11 +0,0 @@
1−#! /usr/bin/env nix-shell
2−#! nix-shell -i bash -p curl go-pup
3−
4−# Fetches a list of all available source mirrors from the sage homepage.
5−# Note that the list is sorted by country, but fetchurl doesn't offer an option
6−# to customize mirror preference.
7−
8−curl -s http://www.sagemath.org/download-source.html \
9− | pup 'table#mirror' \
10− | pup 'a attr{href}' \
11− | sed -e 's/index\.html/sage-${version}.tar.gz/'
pkgs/applications/science/math/sage/flask-oldsessions.nixnew file+36
@@ -0,0 +1,36 @@
1+{ stdenv
2+, buildPythonPackage
3+, fetchFromGitHub
4+, python
5+, flask
6+}:
7+
8+buildPythonPackage rec {
9+ pname = "Flask-OldSessions";
10+ version = "0.10";
11+
12+ # no artifact on pypi: https://github.com/mitsuhiko/flask-oldsessions/issues/1
13+ src = fetchFromGitHub {
14+ owner = "mitsuhiko";
15+ repo = "flask-oldsessions";
16+ rev = "${version}";
17+ sha256 = "04b5m8njjiwld9a0zw55iqwvyjgwcpdbhz1cic8nyhgcmypbicqn";
18+ };
19+
20+ propagatedBuildInputs = [
21+ flask
22+ ];
23+
24+ # missing module flask.testsuite, probably assumes an old version of flask
25+ doCheck = false;
26+ checkPhase = ''
27+ ${python.interpreter} run-tests.py
28+ '';
29+
30+ meta = with stdenv.lib; {
31+ description = "Provides a session class that works like the one in Flask before 0.10.";
32+ license = licenses.bsd2;
33+ maintainers = with maintainers; [ timokau ];
34+ homepage = https://github.com/mitsuhiko/flask-oldsessions;
35+ };
36+}
pkgs/applications/science/math/sage/flask-openid.nixnew file+28
@@ -0,0 +1,28 @@
1+{ stdenv
2+, buildPythonPackage
3+, fetchPypi
4+, flask
5+, python-openid
6+}:
7+
8+buildPythonPackage rec {
9+ pname = "Flask-OpenID";
10+ version = "1.2.5";
11+
12+ src = fetchPypi {
13+ inherit pname version;
14+ sha256 = "1aycwmwi7ilcaa5ab8hm0bp6323zl8z25q9ha0gwrl8aihfgx3ss";
15+ };
16+
17+ propagatedBuildInputs = [
18+ flask
19+ python-openid
20+ ];
21+
22+ meta = with stdenv.lib; {
23+ description = "Adds openid support to flask applications";
24+ license = licenses.bsd2;
25+ maintainers = with maintainers; [ timokau ];
26+ homepage = https://pythonhosted.org/Flask-OpenID/;
27+ };
28+}
pkgs/applications/science/math/sage/openblas-pc.nixnew file+18
@@ -0,0 +1,18 @@
1+{ stdenv
2+, openblasCompat
3+, writeTextFile
4+, name
5+}:
6+
7+writeTextFile {
8+ name = "openblas-${name}-pc-${openblasCompat.version}";
9+ destination = "/lib/pkgconfig/${name}.pc";
10+ text = ''
11+ Name: ${name}
12+ Version: ${openblasCompat.version}
13+
14+ Description: ${name} for SageMath, provided by the OpenBLAS package.
15+ Cflags: -I${openblasCompat}/include
16+ Libs: -L${openblasCompat}/lib -lopenblas
17+ '';
18+}
pkgs/applications/science/math/sage/patchSageShebangs.shdeleted−51
@@ -1,51 +0,0 @@
1−# This is a slightly modified version of nix's default patchShebangs
2−
3−dir="$1"
4−
5−echo "patching sage internal script interpreter paths in $( readlink -f "$dir")"
6−
7−find "$dir" -type f -perm -0100 | while read f; do
8− if [ "$(head -1 "$f" | head -c+2)" != '#!' ]; then
9− # missing shebang => not a script
10− continue
11− fi
12−
13− oldInterpreterLine=$(head -1 "$f" | tail -c+3)
14− read -r oldPath arg0 args <<< "$oldInterpreterLine"
15−
16− if $(echo "$oldPath" | grep -q "/bin/env$"); then
17− # Check for unsupported 'env' functionality:
18− # - options: something starting with a '-'
19− # - environment variables: foo=bar
20− if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
21− echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
22− exit 1
23− fi
24− executable="$arg0"
25− else
26− if [ "$oldPath" = "" ]; then
27− # If no interpreter is specified linux will use /bin/sh. Set
28− # oldpath="/bin/sh" so that we get /nix/store/.../sh.
29− oldPath="/bin/sh"
30− fi
31− executable="$(basename "$oldPath")"
32− args="$arg0 $args"
33− fi
34−
35− newPath="$(echo "$out/bin/$executable $args" | sed 's/[[:space:]]*$//')"
36− if [[ ! -x "$newPath" ]] ; then
37− newPath="$(command -v "$executable" || true)"
38− fi
39−
40− # Strip trailing whitespace introduced when no arguments are present
41− newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"
42−
43− if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
44− if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
45− echo "$f: sage interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
46− # escape the escape chars so that sed doesn't interpret them
47− escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
48− sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
49− fi
50− fi
51−done
pkgs/applications/science/math/sage/patches/dochtml-optional.patchnew file+127
@@ -0,0 +1,127 @@
1+diff --git a/src/doc/common/conf.py b/src/doc/common/conf.py
2+index 25f94f7b7d..9f6139ea4a 100644
3+--- a/src/doc/common/conf.py
4++++ b/src/doc/common/conf.py
5+@@ -622,9 +622,9 @@ def call_intersphinx(app, env, node, contnode):
6+ Check that the link from the thematic tutorials to the reference
7+ manual is relative, see :trac:`20118`::
8+
9+- sage: from sage.env import SAGE_DOC
10+- sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html")
11+- sage: for line in open(thematic_index).readlines():
12++ sage: from sage.env import SAGE_DOC # optional - dochtml
13++ sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html") # optional - dochtml
14++ sage: for line in open(thematic_index).readlines(): # optional - dochtml
15+ ....: if "padics" in line:
16+ ....: sys.stdout.write(line)
17+ <li><a class="reference external" href="../reference/padics/sage/rings/padics/tutorial.html#sage-rings-padics-tutorial" title="(in Sage Reference Manual: p-Adics ...)"><span>Introduction to the -adics</span></a></li>
18+diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
19+index 4236fd05e0..8e499cbaf7 100644
20+--- a/src/sage/doctest/control.py
21++++ b/src/sage/doctest/control.py
22+@@ -87,7 +87,7 @@ class DocTestDefaults(SageObject):
23+ self.sagenb = False
24+ self.long = False
25+ self.warn_long = None
26+- self.optional = set(['sage']) | auto_optional_tags
27++ self.optional = set(['sage', 'dochtml']) | auto_optional_tags
28+ self.randorder = None
29+ self.global_iterations = 1 # sage-runtests default is 0
30+ self.file_iterations = 1 # sage-runtests default is 0
31+@@ -343,7 +343,8 @@ class DocTestController(SageObject):
32+ if not optionaltag_regex.search(o):
33+ raise ValueError('invalid optional tag {!r}'.format(o))
34+
35+- options.optional |= auto_optional_tags
36++ if "sage" in options.optional:
37++ options.optional |= auto_optional_tags
38+
39+ self.options = options
40+ self.files = args
41+@@ -741,7 +742,7 @@ class DocTestController(SageObject):
42+ sage: DC = DocTestController(DD, [dirname])
43+ sage: DC.expand_files_into_sources()
44+ sage: sorted(DC.sources[0].options.optional) # abs tol 1
45+- ['guava', 'magma', 'py3']
46++ ['guava', 'magma']
47+
48+ We check that files are skipped appropriately::
49+
50+@@ -968,7 +969,7 @@ class DocTestController(SageObject):
51+ sage: from sage.doctest.control import DocTestDefaults, DocTestController
52+ sage: DC = DocTestController(DocTestDefaults(), [])
53+ sage: DC._optional_tags_string()
54+- 'sage'
55++ 'dochtml,sage'
56+ sage: DC = DocTestController(DocTestDefaults(optional="all,and,some,more"), [])
57+ sage: DC._optional_tags_string()
58+ 'all'
59+diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
60+index 9255aa848f..cc4712d3ec 100644
61+--- a/src/sage/misc/sagedoc.py
62++++ b/src/sage/misc/sagedoc.py
63+@@ -18,9 +18,9 @@ TESTS:
64+ Check that argspecs of extension function/methods appear correctly,
65+ see :trac:`12849`::
66+
67+- sage: from sage.env import SAGE_DOC
68+- sage: docfilename = os.path.join(SAGE_DOC, 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html')
69+- sage: with open(docfilename) as fobj:
70++ sage: from sage.env import SAGE_DOC # optional - dochtml
71++ sage: docfilename = os.path.join(SAGE_DOC, 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html') # optional - dochtml
72++ sage: with open(docfilename) as fobj: # optional - dochtml
73+ ....: for line in fobj:
74+ ....: if "#sage.symbolic.expression.Expression.numerical_approx" in line:
75+ ....: print(line)
76+@@ -790,11 +790,12 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='',
77+
78+ ::
79+
80+- sage: len(_search_src_or_doc('src', r'matrix\(', 'incidence_structures', 'self', 'combinat', interact=False).splitlines()) > 1
81++ sage: from sage.misc.sagedoc import _search_src_or_doc # optional - dochtml
82++ sage: len(_search_src_or_doc('src', r'matrix\(', 'incidence_structures', 'self', 'combinat', interact=False).splitlines()) > 1 # optional - dochtml
83+ True
84+- sage: 'abvar/homology' in _search_src_or_doc('doc', 'homology', 'variety', interact=False) # long time (4s on sage.math, 2012)
85++ sage: 'abvar/homology' in _search_src_or_doc('doc', 'homology', 'variety', interact=False) # optional - dochtml, long time (4s on sage.math, 2012)
86+ True
87+- sage: 'divisors' in _search_src_or_doc('src', '^ *def prime', interact=False)
88++ sage: 'divisors' in _search_src_or_doc('src', '^ *def prime', interact=False) # optional - dochtml
89+ True
90+ """
91+ # process keywords
92+@@ -1160,9 +1161,9 @@ def search_doc(string, extra1='', extra2='', extra3='', extra4='',
93+ counting the length of ``search_doc('tree',
94+ interact=False).splitlines()`` gives the number of matches. ::
95+
96+- sage: len(search_doc('tree', interact=False).splitlines()) > 4000 # long time
97++ sage: len(search_doc('tree', interact=False).splitlines()) > 4000 # optional - dochtml, long time
98+ True
99+- sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 2000 # long time
100++ sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 2000 # optional - dochtml, long time
101+ True
102+ """
103+ return _search_src_or_doc('doc', string, extra1=extra1, extra2=extra2,
104+@@ -1332,9 +1333,9 @@ class _sage_doc:
105+
106+ EXAMPLES::
107+
108+- sage: browse_sage_doc._open("reference", testing=True)[0] # indirect doctest
109++ sage: browse_sage_doc._open("reference", testing=True)[0] # optional - dochtml, indirect doctest
110+ 'http://localhost:8000/doc/live/reference/index.html'
111+- sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47]
112++ sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] # optional - dochtml
113+ 'Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring'
114+ """
115+ def __init__(self):
116+@@ -1494,9 +1495,9 @@ class _sage_doc:
117+
118+ EXAMPLES::
119+
120+- sage: browse_sage_doc._open("reference", testing=True)[0]
121++ sage: browse_sage_doc._open("reference", testing=True)[0] # optional - dochtml
122+ 'http://localhost:8000/doc/live/reference/index.html'
123+- sage: browse_sage_doc._open("tutorial", testing=True)[1]
124++ sage: browse_sage_doc._open("tutorial", testing=True)[1] # optional - dochtml
125+ '.../html/en/tutorial/index.html'
126+ """
127+ url = self._base_url + os.path.join(name, "index.html")
pkgs/applications/science/math/sage/patches/eclib-regulator-precision.patchnew file+98
@@ -0,0 +1,98 @@
1+diff --git a/src/sage/libs/eclib/interface.py b/src/sage/libs/eclib/interface.py
2+index f77000c478..9d17d412ae 100644
3+--- a/src/sage/libs/eclib/interface.py
4++++ b/src/sage/libs/eclib/interface.py
5+@@ -1014,7 +1014,7 @@ class mwrank_MordellWeil(SageObject):
6+ WARNING: saturation at primes p > 2 will not be done;
7+ ...
8+ Gained index 2
9+- New regulator = 93.857300720636393209
10++ New regulator = 93.85730...
11+ (False, 2, '[ ]')
12+ sage: EQ.points()
13+ [[-2, 3, 1], [2707496766203306, 864581029138191, 2969715140223272], [-13422227300, -49322830557, 12167000000]]
14+@@ -1025,7 +1025,7 @@ class mwrank_MordellWeil(SageObject):
15+ WARNING: saturation at primes p > 3 will not be done;
16+ ...
17+ Gained index 3
18+- New regulator = 10.4285889689595992455
19++ New regulator = 10.42858...
20+ (False, 3, '[ ]')
21+ sage: EQ.points()
22+ [[-2, 3, 1], [-14, 25, 8], [-13422227300, -49322830557, 12167000000]]
23+@@ -1036,7 +1036,7 @@ class mwrank_MordellWeil(SageObject):
24+ WARNING: saturation at primes p > 5 will not be done;
25+ ...
26+ Gained index 5
27+- New regulator = 0.417143558758383969818
28++ New regulator = 0.41714...
29+ (False, 5, '[ ]')
30+ sage: EQ.points()
31+ [[-2, 3, 1], [-14, 25, 8], [1, -1, 1]]
32+@@ -1221,7 +1221,7 @@ class mwrank_MordellWeil(SageObject):
33+ WARNING: saturation at primes p > 2 will not be done;
34+ ...
35+ Gained index 2
36+- New regulator = 93.857300720636393209
37++ New regulator = 93.85730...
38+ (False, 2, '[ ]')
39+ sage: EQ
40+ Subgroup of Mordell-Weil group: [[-2:3:1], [2707496766203306:864581029138191:2969715140223272], [-13422227300:-49322830557:12167000000]]
41+@@ -1235,7 +1235,7 @@ class mwrank_MordellWeil(SageObject):
42+ WARNING: saturation at primes p > 3 will not be done;
43+ ...
44+ Gained index 3
45+- New regulator = 10.4285889689595992455
46++ New regulator = 10.42858...
47+ (False, 3, '[ ]')
48+ sage: EQ
49+ Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [-13422227300:-49322830557:12167000000]]
50+@@ -1249,7 +1249,7 @@ class mwrank_MordellWeil(SageObject):
51+ WARNING: saturation at primes p > 5 will not be done;
52+ ...
53+ Gained index 5
54+- New regulator = 0.417143558758383969818
55++ New regulator = 0.41714...
56+ (False, 5, '[ ]')
57+ sage: EQ
58+ Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]]
59+diff --git a/src/sage/libs/eclib/mwrank.pyx b/src/sage/libs/eclib/mwrank.pyx
60+index a4f89e1ca5..f8a22d2f55 100644
61+--- a/src/sage/libs/eclib/mwrank.pyx
62++++ b/src/sage/libs/eclib/mwrank.pyx
63+@@ -1234,9 +1234,9 @@ cdef class _two_descent:
64+ sage: D2.saturate()
65+ Searching for points (bound = 8)...done:
66+ found points which generate a subgroup of rank 3
67+- and regulator 0.417143558758383969817119544618093396749810106098479
68++ and regulator 0.41714...
69+ Processing points found during 2-descent...done:
70+- now regulator = 0.417143558758383969817119544618093396749810106098479
71++ now regulator = 0.41714...
72+ No saturation being done
73+ sage: D2.getbasis()
74+ '[[1:-1:1], [-2:3:1], [-14:25:8]]'
75+@@ -1281,9 +1281,9 @@ cdef class _two_descent:
76+ sage: D2.saturate()
77+ Searching for points (bound = 8)...done:
78+ found points which generate a subgroup of rank 3
79+- and regulator 0.417143558758383969817119544618093396749810106098479
80++ and regulator 0.41714...
81+ Processing points found during 2-descent...done:
82+- now regulator = 0.417143558758383969817119544618093396749810106098479
83++ now regulator = 0.41714...
84+ No saturation being done
85+ sage: D2.getbasis()
86+ '[[1:-1:1], [-2:3:1], [-14:25:8]]'
87+@@ -1329,9 +1329,9 @@ cdef class _two_descent:
88+ sage: D2.saturate()
89+ Searching for points (bound = 8)...done:
90+ found points which generate a subgroup of rank 3
91+- and regulator 0.417143558758383969817119544618093396749810106098479
92++ and regulator 0.41714...
93+ Processing points found during 2-descent...done:
94+- now regulator = 0.417143558758383969817119544618093396749810106098479
95++ now regulator = 0.41714...
96+ No saturation being done
97+ sage: D2.getbasis()
98+ '[[1:-1:1], [-2:3:1], [-14:25:8]]'
pkgs/applications/science/math/sage/patches/matplotlib-normed-deprecated.patchnew file+12
@@ -0,0 +1,12 @@
1+diff --git a/src/sage/all.py b/src/sage/all.py
2+index 14cec431f1..25a35a0522 100644
3+--- a/src/sage/all.py
4++++ b/src/sage/all.py
5+@@ -310,6 +310,7 @@ warnings.filters.remove(('ignore', None, DeprecationWarning, None, 0))
6+ # Ignore all deprecations from IPython etc.
7+ warnings.filterwarnings('ignore',
8+ module='.*(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic)')
9++warnings.filterwarnings('ignore', "The 'normed' kwarg is deprecated, and has been replaced by the 'density' kwarg.") # matplotlib normed deprecation
10+ # However, be sure to keep OUR deprecation warnings
11+ warnings.filterwarnings('default',
12+ '[\s\S]*See http://trac.sagemath.org/[0-9]* for details.')
pkgs/applications/science/math/sage/patches/maxima-5.41.0-doctests.patchnew file+48
@@ -0,0 +1,48 @@
1+diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
2+index 961c20aaac..3d601d8939 100644
3+--- a/src/sage/interfaces/maxima_abstract.py
4++++ b/src/sage/interfaces/maxima_abstract.py
5+@@ -1743,7 +1743,7 @@ class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement):
6+ sage: y,d = var('y,d')
7+ sage: f = function('f')
8+ sage: latex(maxima(derivative(f(x*y), x)))
9+- \left(\left.{{{\it \partial}}\over{{\it \partial}\, {\it t_0}}}\,f\left({\it t_0}\right) \right|_{{\it t_0}={\it x}\, {\it y}}\right)\,{\it y}
10++ \left(\left.{{{\it \partial}}\over{{\it \partial}\, {\it t}_{0}}}\,f\left({\it t}_{0}\right) \right|_{{\it t}_{0}={\it x}\, {\it y}}\right)\,{\it y}
11+ sage: latex(maxima(derivative(f(x,y,d), d,x,x,y)))
12+ {{{\it \partial}^4}\over{{\it \partial}\,{\it d}\, {\it \partial}\,{\it x}^2\,{\it \partial}\, {\it y}}}\,f\left({\it x} , {\it y} , {\it d}\right)
13+ sage: latex(maxima(d/(d-2)))
14+diff --git a/src/sage/manifolds/differentiable/metric.py b/src/sage/manifolds/differentiable/metric.py
15+index 3cd6ad3235..1e18af1a6b 100644
16+--- a/src/sage/manifolds/differentiable/metric.py
17++++ b/src/sage/manifolds/differentiable/metric.py
18+@@ -993,7 +993,7 @@ class PseudoRiemannianMetric(TensorField):
19+ 2-dimensional differentiable manifold S^2
20+ sage: g.riemann()[:]
21+ [[[[0, 0], [0, 0]], [[0, sin(th)^2], [-sin(th)^2, 0]]],
22+- [[[0, (cos(th)^2 - 1)/sin(th)^2], [1, 0]], [[0, 0], [0, 0]]]]
23++ [[[0, -1], [1, 0]], [[0, 0], [0, 0]]]]
24+
25+ In dimension 2, the Riemann tensor can be expressed entirely in terms of
26+ the Ricci scalar `r`:
27+diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
28+index dfb8751467..27402e54ab 100644
29+--- a/src/sage/symbolic/expression.pyx
30++++ b/src/sage/symbolic/expression.pyx
31+@@ -7154,7 +7154,7 @@ cdef class Expression(CommutativeRingElement):
32+ sage: ex = lcm(sin(x)^2 - 1, sin(x)^2 + sin(x)); ex
33+ (sin(x)^2 + sin(x))*(sin(x)^2 - 1)/(sin(x) + 1)
34+ sage: ex.simplify_full()
35+- -cos(x)^2*sin(x)
36++ sin(x)^3 - sin(x)
37+
38+ TESTS:
39+
40+@@ -10004,7 +10004,7 @@ cdef class Expression(CommutativeRingElement):
41+
42+ sage: f=tan(3*x)
43+ sage: f.simplify_trig()
44+- (4*cos(x)^2 - 1)*sin(x)/(4*cos(x)^3 - 3*cos(x))
45++ -(4*cos(x)^2 - 1)*sin(x)/(4*cos(x)*sin(x)^2 - cos(x))
46+ sage: f.simplify_trig(False)
47+ sin(3*x)/cos(3*x)
48+
pkgs/applications/science/math/sage/patches/numpy-1.14.3.patchnew file+812
@@ -0,0 +1,812 @@
1+diff --git a/src/doc/en/faq/faq-usage.rst b/src/doc/en/faq/faq-usage.rst
2+index 79b4205fd3..9a89bd2136 100644
3+--- a/src/doc/en/faq/faq-usage.rst
4++++ b/src/doc/en/faq/faq-usage.rst
5+@@ -338,7 +338,7 @@ ints. For example::
6+ sage: RealNumber = float; Integer = int
7+ sage: from scipy import stats
8+ sage: stats.ttest_ind(list([1,2,3,4,5]),list([2,3,4,5,.6]))
9+- Ttest_indResult(statistic=0.076752955645333687, pvalue=0.94070490247380478)
10++ Ttest_indResult(statistic=0.0767529..., pvalue=0.940704...)
11+ sage: stats.uniform(0,15).ppf([0.5,0.7])
12+ array([ 7.5, 10.5])
13+
14+diff --git a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
15+index 314811c42b..e5f54ec4c2 100644
16+--- a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
17++++ b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
18+@@ -48,11 +48,13 @@ we could do the following.
19+ sage: B = numpy.array([1.0]*5)
20+ sage: B.shape=(5,1)
21+ sage: print(B)
22+- [[ 1.]
23+- [ 1.]
24+- [ 1.]
25+- [ 1.]
26+- [ 1.]]
27++ [[1.]
28++ [1.]
29++ [1.]
30++ [1.]
31++ [1.]]
32++
33++
34+ sage: print(A)
35+ [ 2.00e+00 3.00e+00 0 0 0 ]
36+ [ 3.00e+00 0 4.00e+00 0 6.00e+00]
37+diff --git a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
38+index 5b89cd75ee..e50b2ea5d4 100644
39+--- a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
40++++ b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
41+@@ -84,7 +84,7 @@ well as take slices
42+ sage: l[3]
43+ 3.0
44+ sage: l[3:6]
45+- array([ 3., 4., 5.])
46++ array([3., 4., 5.])
47+
48+ You can do basic arithmetic operations
49+
50+@@ -147,11 +147,11 @@ also do matrix vector multiplication, and matrix addition
51+ sage: n = numpy.matrix([[1,2],[3,4]],dtype=float)
52+ sage: v = numpy.array([[1],[2]],dtype=float)
53+ sage: n*v
54+- matrix([[ 5.],
55+- [ 11.]])
56++ matrix([[ 5.],
57++ [11.]])
58+ sage: n+n
59+- matrix([[ 2., 4.],
60+- [ 6., 8.]])
61++ matrix([[2., 4.],
62++ [6., 8.]])
63+
64+ If ``n`` was created with :meth:`numpy.array`, then to do matrix vector
65+ multiplication, you would use ``numpy.dot(n,v)``.
66+@@ -170,11 +170,11 @@ to manipulate
67+ 22., 23., 24.])
68+ sage: n.shape=(5,5)
69+ sage: n
70+- array([[ 0., 1., 2., 3., 4.],
71+- [ 5., 6., 7., 8., 9.],
72+- [ 10., 11., 12., 13., 14.],
73+- [ 15., 16., 17., 18., 19.],
74+- [ 20., 21., 22., 23., 24.]])
75++ array([[ 0., 1., 2., 3., 4.],
76++ [ 5., 6., 7., 8., 9.],
77++ [10., 11., 12., 13., 14.],
78++ [15., 16., 17., 18., 19.],
79++ [20., 21., 22., 23., 24.]])
80+
81+ This changes the one-dimensional array into a `5\times 5` array.
82+
83+@@ -187,8 +187,8 @@ NumPy arrays can be sliced as well
84+ sage: n=numpy.array(range(25),dtype=float)
85+ sage: n.shape=(5,5)
86+ sage: n[2:4,1:3]
87+- array([[ 11., 12.],
88+- [ 16., 17.]])
89++ array([[11., 12.],
90++ [16., 17.]])
91+
92+ It is important to note that the sliced matrices are references to
93+ the original
94+@@ -224,8 +224,8 @@ Some particularly useful commands are
95+
96+ sage: x=numpy.arange(0,2,.1,dtype=float)
97+ sage: x
98+- array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ,
99+- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
100++ array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2,
101++ 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
102+
103+ You can see that :meth:`numpy.arange` creates an array of floats increasing by 0.1
104+ from 0 to 2. There is a useful command :meth:`numpy.r_` that is best explained by example
105+@@ -240,10 +240,11 @@ from 0 to 2. There is a useful command :meth:`numpy.r_` that is best explained b
106+ sage: Integer=int
107+ sage: n=r_[0.0:5.0]
108+ sage: n
109+- array([ 0., 1., 2., 3., 4.])
110++ array([0., 1., 2., 3., 4.])
111+ sage: n=r_[0.0:5.0, [0.0]*5]
112+ sage: n
113+- array([ 0., 1., 2., 3., 4., 0., 0., 0., 0., 0.])
114++ array([0., 1., 2., 3., 4., 0., 0., 0., 0., 0.])
115++
116+
117+ :meth:`numpy.r_` provides a shorthand for constructing NumPy arrays efficiently.
118+ Note in the above ``0.0:5.0`` was shorthand for ``0.0, 1.0, 2.0, 3.0, 4.0``.
119+@@ -255,7 +256,7 @@ intervals. We can do this as follows
120+ ::
121+
122+ sage: r_[0.0:5.0:11*j]
123+- array([ 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. ])
124++ array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. ])
125+
126+ The notation ``0.0:5.0:11*j`` expands to a list of 11 equally space
127+ points between 0 and 5 including both endpoints. Note that ``j`` is the
128+@@ -287,23 +288,23 @@ an equally spaced grid with `\Delta x = \Delta y = .25` for
129+ sage: y=numpy.r_[0.0:1.0:5*j]
130+ sage: xx,yy= meshgrid(x,y)
131+ sage: xx
132+- array([[ 0. , 0.25, 0.5 , 0.75, 1. ],
133+- [ 0. , 0.25, 0.5 , 0.75, 1. ],
134+- [ 0. , 0.25, 0.5 , 0.75, 1. ],
135+- [ 0. , 0.25, 0.5 , 0.75, 1. ],
136+- [ 0. , 0.25, 0.5 , 0.75, 1. ]])
137++ array([[0. , 0.25, 0.5 , 0.75, 1. ],
138++ [0. , 0.25, 0.5 , 0.75, 1. ],
139++ [0. , 0.25, 0.5 , 0.75, 1. ],
140++ [0. , 0.25, 0.5 , 0.75, 1. ],
141++ [0. , 0.25, 0.5 , 0.75, 1. ]])
142+ sage: yy
143+- array([[ 0. , 0. , 0. , 0. , 0. ],
144+- [ 0.25, 0.25, 0.25, 0.25, 0.25],
145+- [ 0.5 , 0.5 , 0.5 , 0.5 , 0.5 ],
146+- [ 0.75, 0.75, 0.75, 0.75, 0.75],
147+- [ 1. , 1. , 1. , 1. , 1. ]])
148++ array([[0. , 0. , 0. , 0. , 0. ],
149++ [0.25, 0.25, 0.25, 0.25, 0.25],
150++ [0.5 , 0.5 , 0.5 , 0.5 , 0.5 ],
151++ [0.75, 0.75, 0.75, 0.75, 0.75],
152++ [1. , 1. , 1. , 1. , 1. ]])
153+ sage: f(xx,yy)
154+- array([[ 0. , 0.0625, 0.25 , 0.5625, 1. ],
155+- [ 0.0625, 0.125 , 0.3125, 0.625 , 1.0625],
156+- [ 0.25 , 0.3125, 0.5 , 0.8125, 1.25 ],
157+- [ 0.5625, 0.625 , 0.8125, 1.125 , 1.5625],
158+- [ 1. , 1.0625, 1.25 , 1.5625, 2. ]])
159++ array([[0. , 0.0625, 0.25 , 0.5625, 1. ],
160++ [0.0625, 0.125 , 0.3125, 0.625 , 1.0625],
161++ [0.25 , 0.3125, 0.5 , 0.8125, 1.25 ],
162++ [0.5625, 0.625 , 0.8125, 1.125 , 1.5625],
163++ [1. , 1.0625, 1.25 , 1.5625, 2. ]])
164+
165+ You can see that :meth:`numpy.meshgrid` produces a pair of matrices, here denoted
166+ `xx` and `yy`, such that `(xx[i,j],yy[i,j])` has coordinates
167+@@ -324,7 +325,7 @@ equation `Ax=b` do
168+ sage: b=numpy.array(range(1,6))
169+ sage: x=linalg.solve(A,b)
170+ sage: numpy.dot(A,x)
171+- array([ 1., 2., 3., 4., 5.])
172++ array([1., 2., 3., 4., 5.])
173+
174+ This creates a random 5x5 matrix ``A``, and solves `Ax=b` where
175+ ``b=[0.0,1.0,2.0,3.0,4.0]``. There are many other routines in the :mod:`numpy.linalg`
176+diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx
177+index df85cce43d..34ea164be0 100644
178+--- a/src/sage/calculus/riemann.pyx
179++++ b/src/sage/calculus/riemann.pyx
180+@@ -1191,30 +1191,30 @@ cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values,
181+ sage: zval = numpy.array([[0, 1, 1000],[.2+.3j,1,-.3j],[0,0,0]],dtype = numpy.complex128)
182+ sage: deriv = numpy.array([[.1]],dtype = numpy.float64)
183+ sage: complex_to_spiderweb(zval, deriv,deriv, 4,4,[0,0,0],1,False,0.001)
184+- array([[[ 1., 1., 1.],
185+- [ 1., 1., 1.],
186+- [ 1., 1., 1.]],
187++ array([[[1., 1., 1.],
188++ [1., 1., 1.],
189++ [1., 1., 1.]],
190+ <BLANKLINE>
191+- [[ 1., 1., 1.],
192+- [ 0., 0., 0.],
193+- [ 1., 1., 1.]],
194++ [[1., 1., 1.],
195++ [0., 0., 0.],
196++ [1., 1., 1.]],
197+ <BLANKLINE>
198+- [[ 1., 1., 1.],
199+- [ 1., 1., 1.],
200+- [ 1., 1., 1.]]])
201++ [[1., 1., 1.],
202++ [1., 1., 1.],
203++ [1., 1., 1.]]])
204+
205+ sage: complex_to_spiderweb(zval, deriv,deriv, 4,4,[0,0,0],1,True,0.001)
206+- array([[[ 1. , 1. , 1. ],
207+- [ 1. , 0.05558355, 0.05558355],
208+- [ 0.17301243, 0. , 0. ]],
209++ array([[[1. , 1. , 1. ],
210++ [1. , 0.05558355, 0.05558355],
211++ [0.17301243, 0. , 0. ]],
212+ <BLANKLINE>
213+- [[ 1. , 0.96804683, 0.48044583],
214+- [ 0. , 0. , 0. ],
215+- [ 0.77351965, 0.5470393 , 1. ]],
216++ [[1. , 0.96804683, 0.48044583],
217++ [0. , 0. , 0. ],
218++ [0.77351965, 0.5470393 , 1. ]],
219+ <BLANKLINE>
220+- [[ 1. , 1. , 1. ],
221+- [ 1. , 1. , 1. ],
222+- [ 1. , 1. , 1. ]]])
223++ [[1. , 1. , 1. ],
224++ [1. , 1. , 1. ],
225++ [1. , 1. , 1. ]]])
226+ """
227+ cdef Py_ssize_t i, j, imax, jmax
228+ cdef FLOAT_T x, y, mag, arg, width, target, precision, dmag, darg
229+@@ -1279,14 +1279,14 @@ cpdef complex_to_rgb(np.ndarray[COMPLEX_T, ndim = 2] z_values):
230+ sage: from sage.calculus.riemann import complex_to_rgb
231+ sage: import numpy
232+ sage: complex_to_rgb(numpy.array([[0, 1, 1000]], dtype = numpy.complex128))
233+- array([[[ 1. , 1. , 1. ],
234+- [ 1. , 0.05558355, 0.05558355],
235+- [ 0.17301243, 0. , 0. ]]])
236++ array([[[1. , 1. , 1. ],
237++ [1. , 0.05558355, 0.05558355],
238++ [0.17301243, 0. , 0. ]]])
239+
240+ sage: complex_to_rgb(numpy.array([[0, 1j, 1000j]], dtype = numpy.complex128))
241+- array([[[ 1. , 1. , 1. ],
242+- [ 0.52779177, 1. , 0.05558355],
243+- [ 0.08650622, 0.17301243, 0. ]]])
244++ array([[[1. , 1. , 1. ],
245++ [0.52779177, 1. , 0.05558355],
246++ [0.08650622, 0.17301243, 0. ]]])
247+
248+
249+ TESTS::
250+diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py
251+index 61b1003002..4baee9cbbd 100644
252+--- a/src/sage/combinat/fully_packed_loop.py
253++++ b/src/sage/combinat/fully_packed_loop.py
254+@@ -72,11 +72,11 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False):
255+ sage: _make_color_list(5, ['blue', 'red'])
256+ ['blue', 'red', 'blue', 'red', 'blue']
257+ sage: _make_color_list(5, color_map='summer')
258+- [(0.0, 0.5, 0.40000000000000002),
259+- (0.25098039215686274, 0.62549019607843137, 0.40000000000000002),
260+- (0.50196078431372548, 0.75098039215686274, 0.40000000000000002),
261+- (0.75294117647058822, 0.87647058823529411, 0.40000000000000002),
262+- (1.0, 1.0, 0.40000000000000002)]
263++ [(0.0, 0.5, 0.4),
264++ (0.25098039215686274, 0.6254901960784314, 0.4),
265++ (0.5019607843137255, 0.7509803921568627, 0.4),
266++ (0.7529411764705882, 0.8764705882352941, 0.4),
267++ (1.0, 1.0, 0.4)]
268+ sage: _make_color_list(8, ['blue', 'red'], randomize=True)
269+ ['blue', 'blue', 'red', 'blue', 'red', 'red', 'red', 'blue']
270+ """
271+diff --git a/src/sage/finance/time_series.pyx b/src/sage/finance/time_series.pyx
272+index c37700d14e..49b7298d0b 100644
273+--- a/src/sage/finance/time_series.pyx
274++++ b/src/sage/finance/time_series.pyx
275+@@ -109,8 +109,8 @@ cdef class TimeSeries:
276+
277+ sage: import numpy
278+ sage: v = numpy.array([[1,2], [3,4]], dtype=float); v
279+- array([[ 1., 2.],
280+- [ 3., 4.]])
281++ array([[1., 2.],
282++ [3., 4.]])
283+ sage: finance.TimeSeries(v)
284+ [1.0000, 2.0000, 3.0000, 4.0000]
285+ sage: finance.TimeSeries(v[:,0])
286+@@ -2098,14 +2098,14 @@ cdef class TimeSeries:
287+
288+ sage: w[0] = 20
289+ sage: w
290+- array([ 20. , -3. , 4.5, -2. ])
291++ array([20. , -3. , 4.5, -2. ])
292+ sage: v
293+ [20.0000, -3.0000, 4.5000, -2.0000]
294+
295+ If you want a separate copy do not give the ``copy=False`` option. ::
296+
297+ sage: z = v.numpy(); z
298+- array([ 20. , -3. , 4.5, -2. ])
299++ array([20. , -3. , 4.5, -2. ])
300+ sage: z[0] = -10
301+ sage: v
302+ [20.0000, -3.0000, 4.5000, -2.0000]
303+diff --git a/src/sage/functions/hyperbolic.py b/src/sage/functions/hyperbolic.py
304+index 931a4b41e4..bf33fc483d 100644
305+--- a/src/sage/functions/hyperbolic.py
306++++ b/src/sage/functions/hyperbolic.py
307+@@ -214,7 +214,7 @@ class Function_coth(GinacFunction):
308+ sage: import numpy
309+ sage: a = numpy.arange(2, 5)
310+ sage: coth(a)
311+- array([ 1.03731472, 1.00496982, 1.00067115])
312++ array([1.03731472, 1.00496982, 1.00067115])
313+ """
314+ return 1.0 / tanh(x)
315+
316+@@ -267,7 +267,7 @@ class Function_sech(GinacFunction):
317+ sage: import numpy
318+ sage: a = numpy.arange(2, 5)
319+ sage: sech(a)
320+- array([ 0.26580223, 0.09932793, 0.03661899])
321++ array([0.26580223, 0.09932793, 0.03661899])
322+ """
323+ return 1.0 / cosh(x)
324+
325+@@ -318,7 +318,7 @@ class Function_csch(GinacFunction):
326+ sage: import numpy
327+ sage: a = numpy.arange(2, 5)
328+ sage: csch(a)
329+- array([ 0.27572056, 0.09982157, 0.03664357])
330++ array([0.27572056, 0.09982157, 0.03664357])
331+ """
332+ return 1.0 / sinh(x)
333+
334+@@ -586,7 +586,7 @@ class Function_arccoth(GinacFunction):
335+ sage: import numpy
336+ sage: a = numpy.arange(2,5)
337+ sage: acoth(a)
338+- array([ 0.54930614, 0.34657359, 0.25541281])
339++ array([0.54930614, 0.34657359, 0.25541281])
340+ """
341+ return arctanh(1.0 / x)
342+
343+diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py
344+index 017c85a96f..33fbb499c5 100644
345+--- a/src/sage/functions/orthogonal_polys.py
346++++ b/src/sage/functions/orthogonal_polys.py
347+@@ -810,12 +810,12 @@ class Func_chebyshev_T(ChebyshevFunction):
348+ sage: z2 = numpy.array([[1,2],[1,2]])
349+ sage: z3 = numpy.array([1,2,3.])
350+ sage: chebyshev_T(1,z)
351+- array([ 1., 2.])
352++ array([1., 2.])
353+ sage: chebyshev_T(1,z2)
354+- array([[ 1., 2.],
355+- [ 1., 2.]])
356++ array([[1., 2.],
357++ [1., 2.]])
358+ sage: chebyshev_T(1,z3)
359+- array([ 1., 2., 3.])
360++ array([1., 2., 3.])
361+ sage: chebyshev_T(z,0.1)
362+ array([ 0.1 , -0.98])
363+ """
364+@@ -1095,12 +1095,12 @@ class Func_chebyshev_U(ChebyshevFunction):
365+ sage: z2 = numpy.array([[1,2],[1,2]])
366+ sage: z3 = numpy.array([1,2,3.])
367+ sage: chebyshev_U(1,z)
368+- array([ 2., 4.])
369++ array([2., 4.])
370+ sage: chebyshev_U(1,z2)
371+- array([[ 2., 4.],
372+- [ 2., 4.]])
373++ array([[2., 4.],
374++ [2., 4.]])
375+ sage: chebyshev_U(1,z3)
376+- array([ 2., 4., 6.])
377++ array([2., 4., 6.])
378+ sage: chebyshev_U(z,0.1)
379+ array([ 0.2 , -0.96])
380+ """
381+diff --git a/src/sage/functions/other.py b/src/sage/functions/other.py
382+index 679384c907..d63b295a4c 100644
383+--- a/src/sage/functions/other.py
384++++ b/src/sage/functions/other.py
385+@@ -390,7 +390,7 @@ class Function_ceil(BuiltinFunction):
386+ sage: import numpy
387+ sage: a = numpy.linspace(0,2,6)
388+ sage: ceil(a)
389+- array([ 0., 1., 1., 2., 2., 2.])
390++ array([0., 1., 1., 2., 2., 2.])
391+
392+ Test pickling::
393+
394+@@ -539,7 +539,7 @@ class Function_floor(BuiltinFunction):
395+ sage: import numpy
396+ sage: a = numpy.linspace(0,2,6)
397+ sage: floor(a)
398+- array([ 0., 0., 0., 1., 1., 2.])
399++ array([0., 0., 0., 1., 1., 2.])
400+ sage: floor(x)._sympy_()
401+ floor(x)
402+
403+@@ -840,7 +840,7 @@ def sqrt(x, *args, **kwds):
404+ sage: import numpy
405+ sage: a = numpy.arange(2,5)
406+ sage: sqrt(a)
407+- array([ 1.41421356, 1.73205081, 2. ])
408++ array([1.41421356, 1.73205081, 2. ])
409+ """
410+ if isinstance(x, float):
411+ return math.sqrt(x)
412+diff --git a/src/sage/functions/trig.py b/src/sage/functions/trig.py
413+index e7e7a311cd..e7ff78a9de 100644
414+--- a/src/sage/functions/trig.py
415++++ b/src/sage/functions/trig.py
416+@@ -731,7 +731,7 @@ class Function_arccot(GinacFunction):
417+ sage: import numpy
418+ sage: a = numpy.arange(2, 5)
419+ sage: arccot(a)
420+- array([ 0.46364761, 0.32175055, 0.24497866])
421++ array([0.46364761, 0.32175055, 0.24497866])
422+ """
423+ return math.pi/2 - arctan(x)
424+
425+@@ -787,7 +787,7 @@ class Function_arccsc(GinacFunction):
426+ sage: import numpy
427+ sage: a = numpy.arange(2, 5)
428+ sage: arccsc(a)
429+- array([ 0.52359878, 0.33983691, 0.25268026])
430++ array([0.52359878, 0.33983691, 0.25268026])
431+ """
432+ return arcsin(1.0/x)
433+
434+@@ -845,7 +845,7 @@ class Function_arcsec(GinacFunction):
435+ sage: import numpy
436+ sage: a = numpy.arange(2, 5)
437+ sage: arcsec(a)
438+- array([ 1.04719755, 1.23095942, 1.31811607])
439++ array([1.04719755, 1.23095942, 1.31811607])
440+ """
441+ return arccos(1.0/x)
442+
443+@@ -920,13 +920,13 @@ class Function_arctan2(GinacFunction):
444+ sage: a = numpy.linspace(1, 3, 3)
445+ sage: b = numpy.linspace(3, 6, 3)
446+ sage: atan2(a, b)
447+- array([ 0.32175055, 0.41822433, 0.46364761])
448++ array([0.32175055, 0.41822433, 0.46364761])
449+
450+ sage: atan2(1,a)
451+- array([ 0.78539816, 0.46364761, 0.32175055])
452++ array([0.78539816, 0.46364761, 0.32175055])
453+
454+ sage: atan2(a, 1)
455+- array([ 0.78539816, 1.10714872, 1.24904577])
456++ array([0.78539816, 1.10714872, 1.24904577])
457+
458+ TESTS::
459+
460+diff --git a/src/sage/matrix/constructor.pyx b/src/sage/matrix/constructor.pyx
461+index 19a1d37df0..5780dfae1c 100644
462+--- a/src/sage/matrix/constructor.pyx
463++++ b/src/sage/matrix/constructor.pyx
464+@@ -494,8 +494,8 @@ class MatrixFactory(object):
465+ [7 8 9]
466+ Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
467+ sage: n = matrix(QQ, 2, 2, [1, 1/2, 1/3, 1/4]).numpy(); n
468+- array([[ 1. , 0.5 ],
469+- [ 0.33333333, 0.25 ]])
470++ array([[1. , 0.5 ],
471++ [0.33333333, 0.25 ]])
472+ sage: matrix(QQ, n)
473+ [ 1 1/2]
474+ [1/3 1/4]
475+diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx
476+index 48e0a8a97f..1be5d35b19 100644
477+--- a/src/sage/matrix/matrix_double_dense.pyx
478++++ b/src/sage/matrix/matrix_double_dense.pyx
479+@@ -2546,7 +2546,7 @@ cdef class Matrix_double_dense(Matrix_dense):
480+ sage: P.is_unitary(algorithm='orthonormal')
481+ Traceback (most recent call last):
482+ ...
483+- ValueError: failed to create intent(cache|hide)|optional array-- must have defined dimensions but got (0,)
484++ error: ((lwork==-1)||(lwork >= MAX(1,2*n))) failed for 3rd keyword lwork: zgees:lwork=0
485+
486+ TESTS::
487+
488+@@ -3662,8 +3662,8 @@ cdef class Matrix_double_dense(Matrix_dense):
489+ [0.0 1.0 2.0]
490+ [3.0 4.0 5.0]
491+ sage: m.numpy()
492+- array([[ 0., 1., 2.],
493+- [ 3., 4., 5.]])
494++ array([[0., 1., 2.],
495++ [3., 4., 5.]])
496+
497+ Alternatively, numpy automatically calls this function (via
498+ the magic :meth:`__array__` method) to convert Sage matrices
499+@@ -3674,16 +3674,16 @@ cdef class Matrix_double_dense(Matrix_dense):
500+ [0.0 1.0 2.0]
501+ [3.0 4.0 5.0]
502+ sage: numpy.array(m)
503+- array([[ 0., 1., 2.],
504+- [ 3., 4., 5.]])
505++ array([[0., 1., 2.],
506++ [3., 4., 5.]])
507+ sage: numpy.array(m).dtype
508+ dtype('float64')
509+ sage: m = matrix(CDF, 2, range(6)); m
510+ [0.0 1.0 2.0]
511+ [3.0 4.0 5.0]
512+ sage: numpy.array(m)
513+- array([[ 0.+0.j, 1.+0.j, 2.+0.j],
514+- [ 3.+0.j, 4.+0.j, 5.+0.j]])
515++ array([[0.+0.j, 1.+0.j, 2.+0.j],
516++ [3.+0.j, 4.+0.j, 5.+0.j]])
517+ sage: numpy.array(m).dtype
518+ dtype('complex128')
519+
520+diff --git a/src/sage/matrix/special.py b/src/sage/matrix/special.py
521+index c698ba5e97..b743bab354 100644
522+--- a/src/sage/matrix/special.py
523++++ b/src/sage/matrix/special.py
524+@@ -705,7 +705,7 @@ def diagonal_matrix(arg0=None, arg1=None, arg2=None, sparse=True):
525+
526+ sage: import numpy
527+ sage: entries = numpy.array([1.2, 5.6]); entries
528+- array([ 1.2, 5.6])
529++ array([1.2, 5.6])
530+ sage: A = diagonal_matrix(3, entries); A
531+ [1.2 0.0 0.0]
532+ [0.0 5.6 0.0]
533+@@ -715,7 +715,7 @@ def diagonal_matrix(arg0=None, arg1=None, arg2=None, sparse=True):
534+
535+ sage: j = numpy.complex(0,1)
536+ sage: entries = numpy.array([2.0+j, 8.1, 3.4+2.6*j]); entries
537+- array([ 2.0+1.j , 8.1+0.j , 3.4+2.6j])
538++ array([2. +1.j , 8.1+0.j , 3.4+2.6j])
539+ sage: A = diagonal_matrix(entries); A
540+ [2.0 + 1.0*I 0.0 0.0]
541+ [ 0.0 8.1 0.0]
542+diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
543+index 230f142117..2ab1c0ae68 100644
544+--- a/src/sage/modules/free_module_element.pyx
545++++ b/src/sage/modules/free_module_element.pyx
546+@@ -982,7 +982,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
547+ sage: v.numpy()
548+ array([1, 2, 5/6], dtype=object)
549+ sage: v.numpy(dtype=float)
550+- array([ 1. , 2. , 0.83333333])
551++ array([1. , 2. , 0.83333333])
552+ sage: v.numpy(dtype=int)
553+ array([1, 2, 0])
554+ sage: import numpy
555+@@ -993,7 +993,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
556+ be more efficient but may have unintended consequences::
557+
558+ sage: v.numpy(dtype=None)
559+- array([ 1. , 2. , 0.83333333])
560++ array([1. , 2. , 0.83333333])
561+
562+ sage: w = vector(ZZ, [0, 1, 2^63 -1]); w
563+ (0, 1, 9223372036854775807)
564+diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx
565+index 39fc2970de..2badf98284 100644
566+--- a/src/sage/modules/vector_double_dense.pyx
567++++ b/src/sage/modules/vector_double_dense.pyx
568+@@ -807,13 +807,13 @@ cdef class Vector_double_dense(FreeModuleElement):
569+
570+ sage: v = vector(CDF,4,range(4))
571+ sage: v.numpy()
572+- array([ 0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])
573++ array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])
574+ sage: v = vector(CDF,0)
575+ sage: v.numpy()
576+ array([], dtype=complex128)
577+ sage: v = vector(RDF,4,range(4))
578+ sage: v.numpy()
579+- array([ 0., 1., 2., 3.])
580++ array([0., 1., 2., 3.])
581+ sage: v = vector(RDF,0)
582+ sage: v.numpy()
583+ array([], dtype=float64)
584+@@ -823,11 +823,11 @@ cdef class Vector_double_dense(FreeModuleElement):
585+ sage: import numpy
586+ sage: v = vector(CDF, 3, range(3))
587+ sage: v.numpy()
588+- array([ 0.+0.j, 1.+0.j, 2.+0.j])
589++ array([0.+0.j, 1.+0.j, 2.+0.j])
590+ sage: v.numpy(dtype=numpy.float64)
591+- array([ 0., 1., 2.])
592++ array([0., 1., 2.])
593+ sage: v.numpy(dtype=numpy.float32)
594+- array([ 0., 1., 2.], dtype=float32)
595++ array([0., 1., 2.], dtype=float32)
596+ """
597+ if dtype is None or dtype is self._vector_numpy.dtype:
598+ from copy import copy
599+diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
600+index 17b5ebb84b..92ce35c502 100644
601+--- a/src/sage/numerical/optimize.py
602++++ b/src/sage/numerical/optimize.py
603+@@ -486,9 +486,9 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args)
604+ else:
605+ min = optimize.fmin_tnc(f, x0, approx_grad=True, bounds=cons, messages=0, **args)[0]
606+ elif isinstance(cons[0], function_type) or isinstance(cons[0], Expression):
607+- min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
608++ min = optimize.fmin_cobyla(f, x0, cons, disp=0, **args)
609+ elif isinstance(cons, function_type) or isinstance(cons, Expression):
610+- min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
611++ min = optimize.fmin_cobyla(f, x0, cons, disp=0, **args)
612+ return vector(RDF, min)
613+
614+
615+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
616+index ad9693da62..758fb709b7 100644
617+--- a/src/sage/plot/complex_plot.pyx
618++++ b/src/sage/plot/complex_plot.pyx
619+@@ -61,9 +61,9 @@ cdef inline double mag_to_lightness(double r):
620+
621+ sage: from sage.plot.complex_plot import complex_to_rgb
622+ sage: complex_to_rgb([[0, 1, 10]])
623+- array([[[ 0. , 0. , 0. ],
624+- [ 0.77172568, 0. , 0. ],
625+- [ 1. , 0.22134776, 0.22134776]]])
626++ array([[[0. , 0. , 0. ],
627++ [0.77172568, 0. , 0. ],
628++ [1. , 0.22134776, 0.22134776]]])
629+ """
630+ return atan(log(sqrt(r)+1)) * (4/PI) - 1
631+
632+@@ -82,13 +82,13 @@ def complex_to_rgb(z_values):
633+
634+ sage: from sage.plot.complex_plot import complex_to_rgb
635+ sage: complex_to_rgb([[0, 1, 1000]])
636+- array([[[ 0. , 0. , 0. ],
637+- [ 0.77172568, 0. , 0. ],
638+- [ 1. , 0.64421177, 0.64421177]]])
639++ array([[[0. , 0. , 0. ],
640++ [0.77172568, 0. , 0. ],
641++ [1. , 0.64421177, 0.64421177]]])
642+ sage: complex_to_rgb([[0, 1j, 1000j]])
643+- array([[[ 0. , 0. , 0. ],
644+- [ 0.38586284, 0.77172568, 0. ],
645+- [ 0.82210588, 1. , 0.64421177]]])
646++ array([[[0. , 0. , 0. ],
647++ [0.38586284, 0.77172568, 0. ],
648++ [0.82210588, 1. , 0.64421177]]])
649+ """
650+ import numpy
651+ cdef unsigned int i, j, imax, jmax
652+diff --git a/src/sage/plot/line.py b/src/sage/plot/line.py
653+index 23f5e61446..3b1b51d7cf 100644
654+--- a/src/sage/plot/line.py
655++++ b/src/sage/plot/line.py
656+@@ -502,14 +502,12 @@ def line2d(points, **options):
657+ from sage.plot.all import Graphics
658+ from sage.plot.plot import xydata_from_point_list
659+ from sage.rings.all import CC, CDF
660++ points = list(points) # make sure points is a python list
661+ if points in CC or points in CDF:
662+ pass
663+ else:
664+- try:
665+- if not points:
666+- return Graphics()
667+- except ValueError: # numpy raises a ValueError if not empty
668+- pass
669++ if len(points) == 0:
670++ return Graphics()
671+ xdata, ydata = xydata_from_point_list(points)
672+ g = Graphics()
673+ g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
674+diff --git a/src/sage/plot/plot_field.py b/src/sage/plot/plot_field.py
675+index 0025098a8d..23c80902f3 100644
676+--- a/src/sage/plot/plot_field.py
677++++ b/src/sage/plot/plot_field.py
678+@@ -49,9 +49,10 @@ class PlotField(GraphicPrimitive):
679+ sage: r.xpos_array
680+ [0.0, 0.0, 1.0, 1.0]
681+ sage: r.yvec_array
682+- masked_array(data = [0.0 0.70710678118... 0.70710678118... 0.89442719...],
683+- mask = [False False False False],
684+- fill_value = 1e+20)
685++ masked_array(data=[0.0, 0.70710678118..., 0.70710678118...,
686++ 0.89442719...],
687++ mask=[False, False, False, False],
688++ fill_value=1e+20)
689+
690+ TESTS:
691+
692+diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py
693+index f3da57c370..3806f4b32f 100644
694+--- a/src/sage/plot/streamline_plot.py
695++++ b/src/sage/plot/streamline_plot.py
696+@@ -38,16 +38,14 @@ class StreamlinePlot(GraphicPrimitive):
697+ sage: r.options()['plot_points']
698+ 2
699+ sage: r.xpos_array
700+- array([ 0., 1.])
701++ array([0., 1.])
702+ sage: r.yvec_array
703+- masked_array(data =
704+- [[1.0 1.0]
705+- [0.5403023058681398 0.5403023058681398]],
706+- mask =
707+- [[False False]
708+- [False False]],
709+- fill_value = 1e+20)
710+- <BLANKLINE>
711++ masked_array(
712++ data=[[1.0, 1.0],
713++ [0.5403023058681398, 0.5403023058681398]],
714++ mask=[[False, False],
715++ [False, False]],
716++ fill_value=1e+20)
717+
718+ TESTS:
719+
720+diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx
721+index f66cd898b9..35995886d5 100644
722+--- a/src/sage/probability/probability_distribution.pyx
723++++ b/src/sage/probability/probability_distribution.pyx
724+@@ -130,7 +130,17 @@ cdef class ProbabilityDistribution:
725+ 0.0,
726+ 1.4650000000000003]
727+ sage: b
728+- [0.0, 0.20000000000000001, 0.40000000000000002, 0.60000000000000009, 0.80000000000000004, 1.0, 1.2000000000000002, 1.4000000000000001, 1.6000000000000001, 1.8, 2.0]
729++ [0.0,
730++ 0.2,
731++ 0.4,
732++ 0.6000000000000001,
733++ 0.8,
734++ 1.0,
735++ 1.2000000000000002,
736++ 1.4000000000000001,
737++ 1.6,
738++ 1.8,
739++ 2.0]
740+ """
741+ import pylab
742+ l = [float(self.get_random_element()) for _ in range(num_samples)]
743+diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx
744+index a0bfe080f5..7d95e7a1a8 100644
745+--- a/src/sage/rings/rational.pyx
746++++ b/src/sage/rings/rational.pyx
747+@@ -1056,7 +1056,7 @@ cdef class Rational(sage.structure.element.FieldElement):
748+ dtype('O')
749+
750+ sage: numpy.array([1, 1/2, 3/4])
751+- array([ 1. , 0.5 , 0.75])
752++ array([1. , 0.5 , 0.75])
753+ """
754+ if mpz_cmp_ui(mpq_denref(self.value), 1) == 0:
755+ if mpz_fits_slong_p(mpq_numref(self.value)):
756+diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx
757+index 4c630867a4..64e2187f5b 100644
758+--- a/src/sage/rings/real_mpfr.pyx
759++++ b/src/sage/rings/real_mpfr.pyx
760+@@ -1438,7 +1438,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
761+
762+ sage: import numpy
763+ sage: numpy.arange(10.0)
764+- array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
765++ array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
766+ sage: numpy.array([1.0, 1.1, 1.2]).dtype
767+ dtype('float64')
768+ sage: numpy.array([1.000000000000000000000000000000000000]).dtype
769+diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py
770+index 3d270ebf9d..1144f168e3 100644
771+--- a/src/sage/schemes/elliptic_curves/height.py
772++++ b/src/sage/schemes/elliptic_curves/height.py
773+@@ -1623,18 +1623,18 @@ class EllipticCurveCanonicalHeight:
774+ even::
775+
776+ sage: H.wp_on_grid(v,4)
777+- array([[ 25.43920182, 5.28760943, 5.28760943, 25.43920182],
778+- [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
779+- [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
780+- [ 25.43920182, 5.28760943, 5.28760943, 25.43920182]])
781++ array([[25.43920182, 5.28760943, 5.28760943, 25.43920182],
782++ [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
783++ [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
784++ [25.43920182, 5.28760943, 5.28760943, 25.43920182]])
785+
786+ The array of values on the half-grid::
787+
788+ sage: H.wp_on_grid(v,4,True)
789+- array([[ 25.43920182, 5.28760943],
790+- [ 6.05099485, 1.83757786],
791+- [ 6.05099485, 1.83757786],
792+- [ 25.43920182, 5.28760943]])
793++ array([[25.43920182, 5.28760943],
794++ [ 6.05099485, 1.83757786],
795++ [ 6.05099485, 1.83757786],
796++ [25.43920182, 5.28760943]])
797+ """
798+ tau = self.tau(v)
799+ fk, err = self.fk_intervals(v, 15, CDF)
800+diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx
801+index 2dcb0492b9..2b1a06385c 100644
802+--- a/src/sage/symbolic/ring.pyx
803++++ b/src/sage/symbolic/ring.pyx
804+@@ -1135,7 +1135,7 @@ cdef class NumpyToSRMorphism(Morphism):
805+ sage: cos(numpy.int('2'))
806+ cos(2)
807+ sage: numpy.cos(numpy.int('2'))
808+- -0.41614683654714241
809++ -0.4161468365471424
810+ """
811+ cdef _intermediate_ring
812+
pkgs/applications/science/math/sage/patches/pari-stackwarn.patchnew file+20
@@ -0,0 +1,20 @@
1+diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py
2+index 6bdc9a0..31fc780 100644
3+--- a/src/sage/doctest/parsing.py
4++++ b/src/sage/doctest/parsing.py
5+@@ -40,6 +40,7 @@ from .external import available_software
6+
7+ float_regex = re.compile('\s*([+-]?\s*((\d*\.?\d+)|(\d+\.?))([eE][+-]?\d+)?)')
8+ optional_regex = re.compile(r'(py2|py3|long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w)*))')
9++pari_stack_warning_regex = re.compile(r'\s*\*\*\*.*(Warning: increasing stack size to )\d+\.')
10+ find_sage_prompt = re.compile(r"^(\s*)sage: ", re.M)
11+ find_sage_continuation = re.compile(r"^(\s*)\.\.\.\.:", re.M)
12+ random_marker = re.compile('.*random', re.I)
13+@@ -935,6 +936,7 @@ class SageOutputChecker(doctest.OutputChecker):
14+ <type 'float'>
15+ """
16+ got = self.human_readable_escape_sequences(got)
17++ got = pari_stack_warning_regex.sub('', got)
18+ if isinstance(want, MarkedOutput):
19+ if want.random:
20+ return True
pkgs/applications/science/math/sage/patches/python-5755-hotpatch.patchnew file+28
@@ -0,0 +1,28 @@
1+diff --git a/src/sage/all.py b/src/sage/all.py
2+index ca309ef..be3186b 100644
3+--- a/src/sage/all.py
4++++ b/src/sage/all.py
5+@@ -298,6 +298,23 @@ warnings.filterwarnings('ignore', module='matplotlib[.]font_manager')
6+ warnings.filterwarnings('default',
7+ '[\s\S]*See http://trac.sagemath.org/[0-9]* for details.')
8+
9++# Hotpatch around https://bugs.python.org/issue5755 which won't be fixed for
10++# python 2.7. Idea by https://stackoverflow.com/a/36293331.
11++from distutils.command.build_ext import build_ext
12++from distutils.sysconfig import customize_compiler
13++
14++_build_extensions = build_ext.build_extensions
15++
16++def build_extensions_patched(self):
17++ customize_compiler(self.compiler)
18++ try:
19++ self.compiler.compiler_so.remove("-Wstrict-prototypes")
20++ except (AttributeError, ValueError):
21++ pass
22++ _build_extensions(self)
23++
24++build_ext.build_extensions = build_extensions_patched
25++
26+
27+ # Set a new random number seed as the very last thing
28+ # (so that printing initial_seed() and using that seed
pkgs/applications/science/math/sage/patches/python3-syntax-without-write.patchnew file+40
@@ -0,0 +1,40 @@
1+diff --git a/src/sage/tests/py3_syntax.py b/src/sage/tests/py3_syntax.py
2+index e564860b48..86ab3725f9 100644
3+--- a/src/sage/tests/py3_syntax.py
4++++ b/src/sage/tests/py3_syntax.py
5+@@ -179,15 +179,30 @@ class Python3SyntaxTest(SortedDirectoryWalkerABC):
6+ sage: py3_syntax = Python3SyntaxTest()
7+ sage: py3_syntax.test(src.name)
8+ Invalid Python 3 syntax found:
9+- File "...py", line 1
10+- print "invalid print statement"
11+- ^
12+- SyntaxError: Missing parentheses in call to 'print'
13++ Missing parentheses in call to 'print'...
14+ sage: os.unlink(src.name)
15+ """
16++
17++ # compile all given files in memory, printing all errors
18++ # inspired by the py_compile module (but without writing to file)
19++ script = """
20++import sys
21++import importlib.machinery
22++rv = 0
23++for file in sys.argv[1:]:
24++ loader = importlib.machinery.SourceFileLoader('<sage_test>', file)
25++ source_bytes = loader.get_data(file)
26++ try:
27++ code = loader.source_to_code(source_bytes, file)
28++ except Exception as err:
29++ print(err)
30++ rv = 1
31++sys.exit(rv)
32++"""
33+ cmd = [
34+ 'python3',
35+- '-m', 'py_compile'
36++ '-c',
37++ script,
38+ ] + list(filenames)
39+ process = subprocess.Popen(
40+ cmd,
pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patchnew file+14
@@ -0,0 +1,14 @@
1+reverted:
2+--- b/src/sage/geometry/polyhedron/backend_cdd.py
3++++ a/src/sage/geometry/polyhedron/backend_cdd.py
4+@@ -154,7 +154,9 @@
5+ ... [0.62, -1.38, 0.38],[0.144, -1.04, 0.04],
6+ ... [0.1309090909, -1.0290909091, 0.04]]
7+ sage: Polyhedron(point_list)
8++ Traceback (most recent call last):
9++ ...
10++ ValueError: *Error: Numerical inconsistency is found. Use the GMP exact arithmetic.
11+- A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 14 vertices
12+ sage: Polyhedron(point_list, base_ring=QQ)
13+ A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 14 vertices
14+ """
pkgs/applications/science/math/sage/patches/sagenb-sphinx-1.7.patchnew file+31
@@ -0,0 +1,31 @@
1+From 7419e0246230594ebfd5e7a2fe6b80d67abfc98a Mon Sep 17 00:00:00 2001
2+From: Jeroen Demeyer <jdemeyer@cage.ugent.be>
3+Date: Tue, 20 Mar 2018 10:40:41 +0100
4+Subject: Fix sphinxify doctests
5+
6+---
7+ sagenb/misc/sphinxify.py | 6 +++---
8+ 1 file changed, 3 insertions(+), 3 deletions(-)
9+
10+diff --git a/sagenb/misc/sphinxify.py b/sagenb/misc/sphinxify.py
11+index 4f76d41..15623d9 100644
12+--- a/sagenb/misc/sphinxify.py
13++++ b/sagenb/misc/sphinxify.py
14+@@ -47,11 +47,11 @@ def sphinxify(docstring, format='html'):
15+
16+ sage: from sage.misc.sphinxify import sphinxify
17+ sage: sphinxify('A test')
18+- '...<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
19++ '<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
20+ sage: sphinxify('**Testing**\n`monospace`')
21+- '...<div class="docstring"...<strong>Testing</strong>\n<span class="math"...</p>\n\n\n</div>'
22++ '<div class="docstring"...<strong>Testing</strong>\n<span class="math notranslate"...</p>\n\n\n</div>'
23+ sage: sphinxify('`x=y`')
24+- '...<div class="docstring">\n \n <p><span class="math">x=y</span></p>\n\n\n</div>'
25++ '<div class="docstring">\n \n <p><span class="math notranslate">x=y</span></p>\n\n\n</div>'
26+ sage: sphinxify('`x=y`', format='text')
27+ 'x=y\n'
28+ sage: sphinxify(':math:`x=y`', format='text')
29+--
30+cgit v1.0-1-gd88e
31+
pkgs/applications/science/math/sage/patches/sphinx-1.7.patchnew file+62
@@ -0,0 +1,62 @@
1+diff --git a/src/bin/sage b/src/bin/sage
2+index 397f30cbed..3fc473c343 100755
3+--- a/src/bin/sage
4++++ b/src/bin/sage
5+@@ -980,8 +980,11 @@ if [ "$1" = '-rsyncdist' -o "$1" = "--rsyncdist" ]; then
6+ fi
7+
8+ if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then
9++ # Redirect stdin from /dev/null. This helps with running TeX which
10++ # tends to ask interactive questions if something goes wrong. These
11++ # cause the build to hang. If stdin is /dev/null, TeX just aborts.
12+ shift
13+- exec sage-python23 -m "sage_setup.docbuild" "$@"
14++ exec sage-python23 -m sage_setup.docbuild "$@" </dev/null
15+ fi
16+
17+ if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then
18+diff --git a/src/doc/common/conf.py b/src/doc/common/conf.py
19+index 25f94f7b7d..3f07474d9b 100644
20+--- a/src/doc/common/conf.py
21++++ b/src/doc/common/conf.py
22+@@ -627,7 +627,7 @@ def call_intersphinx(app, env, node, contnode):
23+ sage: for line in open(thematic_index).readlines():
24+ ....: if "padics" in line:
25+ ....: sys.stdout.write(line)
26+- <li><a class="reference external" href="../reference/padics/sage/rings/padics/tutorial.html#sage-rings-padics-tutorial" title="(in Sage Reference Manual: p-Adics ...)"><span>Introduction to the -adics</span></a></li>
27++ <li><a class="reference external" href="../reference/padics/sage/rings/padics/tutorial.html#sage-rings-padics-tutorial" title="(in Sage Reference Manual: p-Adics v...)"><span>Introduction to the -adics</span></a></li>
28+ """
29+ debug_inf(app, "???? Trying intersphinx for %s"%node['reftarget'])
30+ builder = app.builder
31+diff --git a/src/sage/misc/sphinxify.py b/src/sage/misc/sphinxify.py
32+index 4f76d4113a..8f426b5989 100644
33+--- a/src/sage/misc/sphinxify.py
34++++ b/src/sage/misc/sphinxify.py
35+@@ -47,11 +47,11 @@ def sphinxify(docstring, format='html'):
36+
37+ sage: from sage.misc.sphinxify import sphinxify
38+ sage: sphinxify('A test')
39+- '...<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
40++ '<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
41+ sage: sphinxify('**Testing**\n`monospace`')
42+- '...<div class="docstring"...<strong>Testing</strong>\n<span class="math"...</p>\n\n\n</div>'
43++ '<div class="docstring"...<strong>Testing</strong>\n<span class="math...</p>\n\n\n</div>'
44+ sage: sphinxify('`x=y`')
45+- '...<div class="docstring">\n \n <p><span class="math">x=y</span></p>\n\n\n</div>'
46++ '<div class="docstring">\n \n <p><span class="math notranslate nohighlight">x=y</span></p>\n\n\n</div>'
47+ sage: sphinxify('`x=y`', format='text')
48+ 'x=y\n'
49+ sage: sphinxify(':math:`x=y`', format='text')
50+diff --git a/src/sage_setup/docbuild/sphinxbuild.py b/src/sage_setup/docbuild/sphinxbuild.py
51+index fda76a4174..d3413239dd 100644
52+--- a/src/sage_setup/docbuild/sphinxbuild.py
53++++ b/src/sage_setup/docbuild/sphinxbuild.py
54+@@ -207,7 +207,7 @@ def runsphinx():
55+ try:
56+ sys.stdout = SageSphinxLogger(sys.stdout, os.path.basename(output_dir))
57+ sys.stderr = SageSphinxLogger(sys.stderr, os.path.basename(output_dir))
58+- sphinx.cmdline.main(sys.argv)
59++ sphinx.cmdline.main(sys.argv[1:])
60+ finally:
61+ sys.stdout = saved_stdout
62+ sys.stderr = saved_stderr
pkgs/applications/science/math/sage/patches/zn_poly_version.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
2+index 7ff4f21675..1d72168833 100644
3+--- a/src/sage/misc/package.py
4++++ b/src/sage/misc/package.py
5+@@ -350,7 +350,7 @@ def package_versions(package_type, local=False):
6+ sage: 'gap' in std
7+ True
8+ sage: std['zn_poly']
9+- ('0.9.p11', '0.9.p11')
10++ ('0.9', '0.9.p11')
11+ """
12+ return {pkg['name']: (pkg['installed_version'], pkg['remote_version']) for pkg in list_packages(package_type, local=local).values()}
13+
pkgs/applications/science/math/sage/pybrial.nixnew file+29
@@ -0,0 +1,29 @@
1+{ stdenv
2+, fetchFromGitHub
3+, buildPythonPackage
4+}:
5+# This has a cyclic dependency with sage. I don't include sage in the
6+# buildInputs and let python figure it out at runtime. Because of this,
7+# I don't include the package in the main nipxkgs tree. It wouldn't be useful
8+# outside of sage anyways (as you could just directly depend on sage and use
9+# it).
10+buildPythonPackage rec {
11+ pname = "pyBRiAl";
12+ version = "1.2.3";
13+
14+ # included with BRiAl source
15+ src = fetchFromGitHub {
16+ owner = "BRiAl";
17+ repo = "BRiAl";
18+ rev = "${version}";
19+ sha256 = "0qy4cwy7qrk4zg151cmws5cglaa866z461cnj9wdnalabs7v7qbg";
20+ };
21+
22+ sourceRoot = "source/sage-brial";
23+
24+ meta = with stdenv.lib; {
25+ description = "python implementation of BRiAl";
26+ license = licenses.gpl2;
27+ maintainers = with maintainers; [ timokau ];
28+ };
29+}
pkgs/applications/science/math/sage/python-openid.nixnew file+42
@@ -0,0 +1,42 @@
1+{ stdenv
2+, buildPythonPackage
3+, fetchPypi
4+, isPy3k
5+, django
6+, nose
7+, twill
8+, pycrypto
9+}:
10+
11+buildPythonPackage rec {
12+ pname = "python-openid";
13+ version = "2.2.5";
14+
15+ disabled = isPy3k;
16+
17+ src = fetchPypi {
18+ inherit pname version;
19+ sha256 = "1vvhxlghjan01snfdc4k7ykd80vkyjgizwgg9bncnin8rqz1ricj";
20+ };
21+
22+ propagatedBuildInputs = [
23+ django
24+ twill
25+ pycrypto
26+ ];
27+
28+ # Cannot access the djopenid example module.
29+ # I don't know how to fix that (adding the examples dir to PYTHONPATH doesn't work)
30+ doCheck = false;
31+ checkInputs = [ nose ];
32+ checkPhase = ''
33+ nosetests
34+ '';
35+
36+ meta = with stdenv.lib; {
37+ description = "OpenID library for Python";
38+ license = licenses.asl20;
39+ maintainers = with maintainers; [ timokau ];
40+ homepage = https://github.com/openid/python-openid/;
41+ };
42+}
pkgs/applications/science/math/sage/sage-env.nixnew file+162
@@ -0,0 +1,162 @@
1+{ stdenv
2+, lib
3+, writeTextFile
4+, python
5+, sage-src
6+, sagelib
7+, env-locations
8+, gfortran
9+, bash
10+, coreutils
11+, gnused
12+, gnugrep
13+, binutils
14+, pythonEnv
15+, python3
16+, pkg-config
17+, pari
18+, gap-libgap-compatible
19+, libgap
20+, ecl
21+, maxima-ecl
22+, singular
23+, giac
24+, palp
25+, rWrapper
26+, gfan
27+, cddlib
28+, jmol
29+, tachyon
30+, glpk
31+, eclib
32+, sympow
33+, nauty
34+, sqlite
35+, ppl
36+, ecm
37+, lcalc
38+, rubiks
39+, flintqs
40+, openblas-cblas-pc
41+, flint
42+, gmp
43+, mpfr
44+, pynac
45+, zlib
46+, gsl
47+, ntl
48+}:
49+
50+let
51+ runtimepath = (lib.makeBinPath ([
52+ "@sage-local@"
53+ "@sage-local@/build"
54+ pythonEnv
55+ # empty python env to add python wrapper that clears PYTHONHOME (see
56+ # wrapper.nix). This is necessary because sage will call the python3 binary
57+ # (from python2 code). The python2 PYTHONHOME (again set in wrapper.nix)
58+ # will then confuse python3, if it is not overwritten.
59+ python3.buildEnv
60+ gfortran # for inline fortran
61+ stdenv.cc # for cython
62+ bash
63+ coreutils
64+ gnused
65+ gnugrep
66+ binutils.bintools
67+ pkg-config
68+ pari
69+ gap-libgap-compatible
70+ libgap
71+ ecl
72+ maxima-ecl
73+ singular
74+ giac
75+ palp
76+ rWrapper
77+ gfan
78+ cddlib
79+ jmol
80+ tachyon
81+ glpk
82+ eclib
83+ sympow
84+ nauty
85+ sqlite
86+ ppl
87+ ecm
88+ lcalc
89+ rubiks
90+ flintqs
91+ ]
92+ ));
93+in
94+writeTextFile rec {
95+ name = "sage-env";
96+ destination = "/${name}";
97+ text = ''
98+ export PKG_CONFIG_PATH='${lib.concatStringsSep ":" (map (pkg: "${pkg}/lib/pkgconfig") [
99+ # This is only needed in the src/sage/misc/cython.py test and I'm not sure if there's really a use-case
100+ # for it outside of the tests. However since singular and openblas are runtime dependencies anyways
101+ # and openblas-cblas-pc is tiny, it doesn't really hurt to include.
102+ singular
103+ openblas-cblas-pc
104+ ])
105+ }'
106+ export SAGE_ROOT='${sage-src}'
107+ export SAGE_LOCAL='@sage-local@'
108+ export SAGE_SHARE='${sagelib}/share'
109+ orig_path="$PATH"
110+ export PATH='${runtimepath}'
111+
112+ # set dependent vars, like JUPYTER_CONFIG_DIR
113+ source "${sage-src}/src/bin/sage-env"
114+ export PATH="${runtimepath}:$orig_path" # sage-env messes with PATH
115+
116+ export SAGE_LOGS="$TMPDIR/sage-logs"
117+ export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
118+ export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sage-src}/src/doc}"
119+
120+ # set locations of dependencies
121+ . ${env-locations}/sage-env-locations
122+
123+ # needed for cython
124+ export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
125+ # cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
126+ export LDFLAGS='${
127+ lib.concatStringsSep " " (map (pkg: "-L${pkg}/lib") [
128+ flint
129+ libgap
130+ glpk
131+ gmp
132+ mpfr
133+ pari
134+ pynac
135+ zlib
136+ eclib
137+ gsl
138+ ntl
139+ jmol
140+ sympow
141+ ])
142+ }'
143+ export CFLAGS='${
144+ lib.concatStringsSep " " (map (pkg: "-isystem ${pkg}/include") [
145+ singular
146+ gmp.dev
147+ glpk
148+ flint
149+ libgap
150+ pynac
151+ mpfr.dev
152+ ])
153+ }'
154+
155+ export SAGE_LIB='${sagelib}/${python.sitePackages}'
156+
157+ export SAGE_EXTCODE='${sage-src}/src/ext'
158+
159+ # for find_library
160+ export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular]}:$DYLD_LIBRARY_PATH"
161+ '';
162+}
pkgs/applications/science/math/sage/sage-src.nixnew file+197
@@ -0,0 +1,197 @@
1+{ stdenv
2+, fetchFromGitHub
3+, fetchpatch
4+}:
5+stdenv.mkDerivation rec {
6+ version = "8.2";
7+ name = "sage-src-${version}";
8+
9+ src = fetchFromGitHub {
10+ owner = "sagemath";
11+ repo = "sage";
12+ rev = version;
13+ sha256 = "0d7vc16s7dj23an2cb8v5bhbnc6nsw20qhnnxr0xh8qg629027b8";
14+ };
15+
16+ nixPatches = [
17+ # https://trac.sagemath.org/ticket/25309
18+ (fetchpatch {
19+ name = "spkg-paths.patch";
20+ url = "https://git.sagemath.org/sage.git/patch/?h=97f06fddee920399d4fcda65aa9b0925774aec69&id=a86151429ccce1ddd085e8090ada8ebdf02f3310";
21+ sha256 = "1xb9108rzzkdhn71vw44525620d3ww9jv1fph5a77v9y7nf9wgr7";
22+ })
23+ (fetchpatch {
24+ name = "maxima-fas.patch";
25+ url = "https://git.sagemath.org/sage.git/patch/?h=97f06fddee920399d4fcda65aa9b0925774aec69";
26+ sha256 = "14s50yg3hpw9cp3v581dx7zfmpm2j972im7x30iwki8k45mjvk3i";
27+ })
28+
29+ # https://trac.sagemath.org/ticket/25328
30+ (fetchpatch {
31+ name = "respect-jupyter-path.patch";
32+ url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=029123097d79f2c67bca2d725c470ef667a88ca2";
33+ sha256 = "0qw9p541ip0kn2gfvn4i05a06p50f3q46847gqfjjgzxhn62znfw";
34+ })
35+
36+ # https://trac.sagemath.org/ticket/25358
37+ (fetchpatch {
38+ name = "safe-directory-test-without-patch.patch";
39+ url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=dc673c17555efca611f68398d5013b66e9825463";
40+ sha256 = "1hhannz7xzprijakn2w2d0rhd5zv2zikik9p51i87bas3nc658f7";
41+ })
42+
43+ # https://trac.sagemath.org/ticket/25357 rebased on 8.2
44+ ./patches/python3-syntax-without-write.patch
45+
46+ # https://trac.sagemath.org/ticket/25314
47+ (fetchpatch {
48+ name = "make-qepcad-test-optional.patch";
49+ url = "https://git.sagemath.org/sage.git/patch/?h=fe294c58bd035ef427e268901d54a6faa0058138";
50+ sha256 = "003d5baf5c0n5rfg010ijwkwz8kg0s414cxwczs2vhdayxdixbix";
51+ })
52+
53+ # https://trac.sagemath.org/ticket/25316
54+ ./patches/python-5755-hotpatch.patch
55+
56+ # https://trac.sagemath.org/ticket/25354
57+ # https://trac.sagemath.org/ticket/25531
58+ (fetchpatch {
59+ name = "cysignals-include.patch";
60+ url = "https://git.sagemath.org/sage.git/patch/?h=28778bd25a37c80884d2b24e0683fb2989300cef";
61+ sha256 = "0fiiiw91pgs8avm9ggj8hb64bhqzl6jcw094d94nhirmh8w2jmc5";
62+ })
63+
64+ # https://trac.sagemath.org/ticket/25315
65+ (fetchpatch {
66+ name = "find-libraries-in-dyld-library-path.patch";
67+ url = "https://git.sagemath.org/sage.git/patch/?h=20d4593876ce9c6004eac2ab6fd61786d0d96a06";
68+ sha256 = "1k3afq3qlzmgqwx6rzs5wv153vv9dsf5rk8pi61g57l3r3npbjmc";
69+ })
70+
71+ # Pari upstream has since accepted a patch, so this patch won't be necessary once sage updates pari.
72+ # https://trac.sagemath.org/ticket/25312
73+ ./patches/pari-stackwarn.patch
74+
75+ # https://trac.sagemath.org/ticket/25311
76+ ./patches/zn_poly_version.patch
77+
78+ # https://trac.sagemath.org/ticket/25345
79+ # (upstream patch doesn't apply on 8.2 source)
80+ ./patches/dochtml-optional.patch
81+ ];
82+
83+ packageUpgradePatches = [
84+ # matplotlib 2.2.2 deprecated `normed` (replaced by `density`).
85+ # This patch only ignores the warning. It would be equally easy to fix it
86+ # (by replacing all mentions of `normed` by `density`), but its better to
87+ # stay close to sage upstream. I didn't open an upstream ticket about it
88+ # because the matplotlib update also requires a new dependency (kiwisolver)
89+ # and I don't want to invest the time to learn how to add it.
90+ ./patches/matplotlib-normed-deprecated.patch
91+
92+ # Update to 20171219 broke the doctests because of insignificant precision
93+ # changes, make the doctests less fragile.
94+ # I didn't open an upstream ticket because its not entirely clear if
95+ # 20171219 is really "released" yet. It is listed on the github releases
96+ # page, but not marked as "latest release" and the homepage still links to
97+ # the last version.
98+ ./patches/eclib-regulator-precision.patch
99+
100+ # sphinx 1.6 -> 1.7 upgrade
101+ # https://trac.sagemath.org/ticket/24935
102+ ./patches/sphinx-1.7.patch
103+
104+ # https://trac.sagemath.org/ticket/25320
105+ (fetchpatch {
106+ name = "zero_division_error_formatting.patch";
107+ url = "https://git.sagemath.org/sage.git/patch/?h=f79070ddd09fa0ad6b340b097bd8d690a7aa35f0";
108+ sha256 = "02wsc3wbp8g8dk5jcjyv18d9v537h3zp5v8lwir46j4na4kj0dlb";
109+ })
110+
111+ # Adapt hashes to new boost version
112+ # https://trac.sagemath.org/ticket/22243
113+ # (this ticket doesn't only upgrade boost but also avoids this problem in the future)
114+ (fetchpatch {
115+ name = "boost-upgrade.patch";
116+ url = "https://git.sagemath.org/sage.git/patch?id=a24a9c6b30b93957333a3116196214a931325b69";
117+ sha256 = "0z3870g2ms2a81vnw08dc2i4k7jr62w8fggvcdwaavgd1wvdxwfl";
118+ })
119+
120+ # gfan 0.6.2
121+ # https://trac.sagemath.org/ticket/23353
122+ (fetchpatch {
123+ name = "gfan-update.patch";
124+ url = "https://git.sagemath.org/sage.git/patch/?h=420215fc469cde733ec7a339e59b78ad6eec804c&id=112498a293ea2bf563e41aed35f1aa608f01b349";
125+ sha256 = "0ga3hkx8cr23dpc919lgvpi5lmy0d728jkq9z6kf0fl9s8g31mxb";
126+ })
127+
128+ # New glpk version has new warnings, filter those out until upstream sage has found a solution
129+ # https://trac.sagemath.org/ticket/24824
130+ (fetchpatch {
131+ url = "https://salsa.debian.org/science-team/sagemath/raw/58bbba93a807ca2933ca317501d093a1bb4b84db/debian/patches/dt-version-glpk-4.65-ignore-warnings.patch";
132+ sha256 = "0b9293v73wb4x13wv5zwyjgclc01zn16msccfzzi6znswklgvddp";
133+ stripLen = 1;
134+ })
135+
136+ # https://trac.sagemath.org/ticket/25329
137+ (fetchpatch {
138+ name = "dont-check-exact-glpk-version.patch";
139+ url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=89d068d8d77316bfffa6bf8e9ebf70b3b3b88e5c";
140+ sha256 = "00knwxs6fmymfgfl0q5kcavmxm9sf90a4r76y35n5s55gj8pl918";
141+ })
142+
143+ # https://trac.sagemath.org/ticket/25355
144+ (fetchpatch {
145+ name = "maxima-5.41.0.patch";
146+ url = "https://git.sagemath.org/sage.git/patch/?id=87328023c4739abdf24108038201e3fa9bdfc739";
147+ sha256 = "0hxi7qr5mfx1bc32r8j7iba4gzd7c6v63asylyf5cbyp86azpb7i";
148+ })
149+
150+ # Update cddlib from 0.94g to 0.94h.
151+ # https://trac.sagemath.org/ticket/25341 (doesn't apply to 8.2 sources)
152+ (fetchpatch {
153+ url = "https://salsa.debian.org/science-team/sagemath/raw/58bbba93a807ca2933ca317501d093a1bb4b84db/debian/patches/u2-version-cddlib-094h.patch";
154+ sha256 = "0fmw7pzbaxs2dshky6iw9pr8i23p9ih2y2lw661qypdrxh5xw03k";
155+ stripLen = 1;
156+ })
157+ ./patches/revert-269c1e1551285.patch
158+
159+
160+ # Only formatting changes.
161+ # https://trac.sagemath.org/ticket/25260
162+ ./patches/numpy-1.14.3.patch
163+
164+ # https://trac.sagemath.org/ticket/24374
165+ (fetchpatch {
166+ name = "networkx-2.1.patch";
167+ url = "https://salsa.debian.org/science-team/sagemath/raw/487df9ae48ca1d93d9b1cb3af8745d31e30fb741/debian/patches/u0-version-networkx-2.1.patch";
168+ sha256 = "1xxxawygbgxgvlv7b4w8hhzgdnva4rhmgdxaiaa3pwdwln0yc750";
169+ stripLen = 1;
170+ })
171+
172+ ];
173+
174+ patches = nixPatches ++ packageUpgradePatches;
175+
176+ postPatch = ''
177+ # make sure shebangs etc are fixed, but sage-python23 still works
178+ find . -type f -exec sed \
179+ -e 's/sage-python23/python/g' \
180+ -i {} \;
181+
182+ echo '#!${stdenv.shell}
183+ python "$@"' > build/bin/sage-python23
184+
185+ # Do not use sage-env-config (generated by ./configure).
186+ # Instead variables are set manually.
187+ echo '# do nothing' > src/bin/sage-env-config
188+ '';
189+
190+ configurePhase = "# do nothing";
191+
192+ buildPhase = "# do nothing";
193+
194+ installPhase = ''
195+ cp -r . "$out"
196+ '';
197+}
pkgs/applications/science/math/sage/sage-with-env.nixnew file+129
@@ -0,0 +1,129 @@
1+{ stdenv
2+, lib
3+, makeWrapper
4+, sage-env
5+, sage-src
6+, sagelib
7+, sagedoc
8+, openblasCompat
9+, openblas-blas-pc
10+, openblas-cblas-pc
11+, openblas-lapack-pc
12+, pkg-config
13+, three
14+, singular
15+, libgap
16+, gap-libgap-compatible
17+, gcc
18+, giac
19+, maxima-ecl
20+, pari
21+, gmp
22+, gfan
23+, python2
24+, flintqs
25+, eclib
26+, ntl
27+, ecm
28+, pynac
29+, pythonEnv
30+}:
31+
32+let
33+ buildInputs = [
34+ pythonEnv # for patchShebangs
35+ makeWrapper
36+ pkg-config
37+ openblasCompat # lots of segfaults with regular (64 bit) openblas
38+ openblas-blas-pc
39+ openblas-cblas-pc
40+ openblas-lapack-pc
41+ singular
42+ three
43+ pynac
44+ giac
45+ libgap
46+ gap-libgap-compatible
47+ pari
48+ gmp
49+ gfan
50+ maxima-ecl
51+ eclib
52+ flintqs
53+ ntl
54+ ecm
55+ ];
56+
57+ # remove python prefix, replace "-" in the name by "_", apply patch_names
58+ # python2.7-some-pkg-1.0 -> some_pkg-1.0
59+ pkg_to_spkg_name = pkg: patch_names: let
60+ parts = lib.splitString "-" pkg.name;
61+ # remove python2.7-
62+ stripped_parts = if (builtins.head parts) == python2.libPrefix then builtins.tail parts else parts;
63+ version = lib.last stripped_parts;
64+ orig_pkgname = lib.init stripped_parts;
65+ pkgname = patch_names (lib.concatStringsSep "_" orig_pkgname);
66+ in pkgname + "-" + version;
67+
68+
69+ # return the names of all dependencies in the transitive closure
70+ transitiveClosure = dep:
71+ if isNull dep then
72+ # propagatedBuildInputs might contain null
73+ # (although that might be considered a programming error in the derivation)
74+ []
75+ else
76+ [ dep ] ++ (
77+ if builtins.hasAttr "propagatedBuildInputs" dep then
78+ lib.unique (builtins.concatLists (map transitiveClosure dep.propagatedBuildInputs))
79+ else
80+ []
81+ );
82+
83+ allInputs = lib.remove null (buildInputs ++ pythonEnv.extraLibs);
84+ transitiveDeps = lib.unique (builtins.concatLists (map transitiveClosure allInputs ));
85+ # fix differences between spkg and sage names
86+ # (could patch sage instead, but this is more lightweight and also works for packages depending on sage)
87+ patch_names = builtins.replaceStrings [
88+ "zope.interface"
89+ "node_three"
90+ ] [
91+ "zope_interface"
92+ "threejs"
93+ ];
94+ # spkg names (this_is_a_package-version) of all transitive deps
95+ input_names = map (dep: pkg_to_spkg_name dep patch_names) transitiveDeps;
96+in
97+stdenv.mkDerivation rec {
98+ version = sage-src.version;
99+ name = "sage-with-env-${version}";
100+
101+ inherit buildInputs;
102+
103+ src = sage-src;
104+
105+ configurePhase = "#do nothing";
106+
107+ buildPhase = ''
108+ mkdir installed
109+ for pkg in ${lib.concatStringsSep " " input_names}; do
110+ touch "installed/$pkg"
111+ done
112+ '';
113+
114+ installPhase = ''
115+ mkdir -p "$out/var/lib/sage"
116+ cp -r installed $out/var/lib/sage
117+
118+ mkdir -p "$out/etc"
119+ # sage tests will try to create this file if it doesn't exist
120+ touch "$out/etc/sage-started.txt"
121+
122+ mkdir -p "$out/build"
123+ cp -r src/bin "$out/bin"
124+ cp -r build/bin "$out/build/bin"
125+ cp -f '${sage-env}/sage-env' "$out/bin/sage-env"
126+ substituteInPlace "$out/bin/sage-env" \
127+ --subst-var-by sage-local "$out"
128+ '';
129+}
pkgs/applications/science/math/sage/sage-wrapper.nixnew file+41
@@ -0,0 +1,41 @@
1+{ stdenv
2+, makeWrapper
3+, sage
4+, sage-src
5+, sagedoc
6+, withDoc
7+}:
8+
9+stdenv.mkDerivation rec {
10+ version = sage.version;
11+ name = "sage-wrapper-${version}";
12+
13+ buildInputs = [
14+ makeWrapper
15+ ];
16+
17+ unpackPhase = "#do nothing";
18+ configurePhase = "#do nothing";
19+ buildPhase = "#do nothing";
20+
21+ installPhase = ''
22+ mkdir -p "$out/bin"
23+ makeWrapper "${sage}/bin/sage" "$out/bin/sage" \
24+ --set SAGE_DOC_SRC_OVERRIDE "${sage-src}/src/doc" ${
25+ stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
26+ }
27+ '';
28+
29+ doInstallCheck = withDoc;
30+ installCheckPhase = ''
31+ export HOME="$TMPDIR/sage-home"
32+ mkdir -p "$HOME"
33+ "$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
34+ '';
35+
36+ meta = with stdenv.lib; {
37+ description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
38+ license = licenses.gpl2;
39+ maintainers = with maintainers; [ timokau ];
40+ };
41+}
pkgs/applications/science/math/sage/sage.nixnew file+32
@@ -0,0 +1,32 @@
1+{ stdenv
2+, sage-with-env
3+, makeWrapper
4+}:
5+
6+stdenv.mkDerivation rec {
7+ version = sage-with-env.version;
8+ name = "sage-${version}";
9+
10+ buildInputs = [
11+ makeWrapper
12+ ];
13+
14+ unpackPhase = "#do nothing";
15+ configurePhase = "#do nothing";
16+ buildPhase = "#do nothing";
17+
18+ installPhase = ''
19+ mkdir -p "$out/bin"
20+ # Like a symlink, but make sure that $0 points to the original.
21+ makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage"
22+ '';
23+
24+ doInstallCheck = true;
25+ installCheckPhase = ''
26+ export HOME="$TMPDIR/sage-home"
27+ mkdir -p "$HOME"
28+
29+ # "--long" tests are in the order of 1h, without "--long" its 1/2h
30+ "$out/bin/sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage --long --all
31+ '';
32+}
pkgs/applications/science/math/sage/sagedoc.nixnew file+97
@@ -0,0 +1,97 @@
1+{ pkgs
2+, stdenv
3+, sage-src
4+, env-locations
5+, sage-with-env
6+, sagelib
7+, python2
8+, psutil
9+, future
10+, sphinx
11+, sagenb
12+, maxima-ecl
13+, networkx
14+, scipy
15+, sympy
16+, matplotlib
17+, pillow
18+, ipykernel
19+, jupyter_client
20+, tachyon
21+, jmol
22+, ipywidgets
23+, typing
24+, cddlib
25+, pybrial
26+}:
27+
28+stdenv.mkDerivation rec {
29+ version = sage-src.version;
30+ name = "sagedoc-${version}";
31+
32+
33+ # Building the documentation has many dependencies, because all documented
34+ # modules are imported and because matplotlib is used to produce plots.
35+ buildInputs = [
36+ sagelib
37+ python2
38+ psutil
39+ future
40+ sphinx
41+ sagenb
42+ maxima-ecl
43+ networkx
44+ scipy
45+ sympy
46+ matplotlib
47+ pillow
48+ ipykernel
49+ jupyter_client
50+ tachyon
51+ jmol
52+ ipywidgets
53+ typing
54+ cddlib
55+ pybrial
56+ ];
57+
58+ unpackPhase = ''
59+ export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
60+ export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
61+
62+ cp -r "${sage-src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
63+ chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
64+ '';
65+
66+ buildPhase = ''
67+ export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
68+ export HOME="$TMPDIR/sage_home"
69+ mkdir -p "$HOME"
70+
71+ ${sage-with-env}/bin/sage -python -m sage_setup.docbuild \
72+ --mathjax \
73+ --no-pdf-links \
74+ all html
75+ '';
76+
77+ installPhase = ''
78+ cd "$SAGE_DOC_OVERRIDE"
79+
80+ mkdir -p "$out/share/doc/sage"
81+ cp -r html "$out"/share/doc/sage
82+
83+ # Replace duplicated files by symlinks (Gentoo)
84+ cd "$out"/share/doc/sage
85+ mv html/en/_static{,.tmp}
86+ for _dir in `find -name _static` ; do
87+ rm -r $_dir
88+ ln -s /share/doc/sage/html/en/_static $_dir
89+ done
90+ mv html/en/_static{.tmp,}
91+ '';
92+
93+ doCheck = true;
94+ checkPhase = ''
95+ ${sage-with-env}/bin/sage -t --optional=dochtml --all
96+ '';
97+}
pkgs/applications/science/math/sage/sagelib.nixnew file+139
@@ -0,0 +1,139 @@
1+{ stdenv
2+, sage-src
3+, perl
4+, buildPythonPackage
5+, arb
6+, openblasCompat
7+, openblas-blas-pc
8+, openblas-cblas-pc
9+, openblas-lapack-pc
10+, brial
11+, cliquer
12+, cypari2
13+, cysignals
14+, cython
15+, ecl
16+, eclib
17+, ecm
18+, flint
19+, gd
20+, givaro
21+, glpk
22+, gsl
23+, iml
24+, jinja2
25+, lcalc
26+, lrcalc
27+, libgap
28+, linbox
29+, m4ri
30+, m4rie
31+, libmpc
32+, mpfi
33+, ntl
34+, numpy
35+, pari
36+, pkgconfig
37+, planarity
38+, ppl
39+, pynac
40+, python
41+, ratpoints
42+, readline
43+, rankwidth
44+, symmetrica
45+, zn_poly
46+, fflas-ffpack
47+, boost
48+, singular
49+, pip
50+, jupyter_core
51+}:
52+
53+buildPythonPackage rec {
54+ format = "other";
55+ version = sage-src.version;
56+ pname = "sagelib";
57+
58+ src = sage-src;
59+
60+ nativeBuildInputs = [
61+ iml
62+ perl
63+ openblas-blas-pc
64+ openblas-cblas-pc
65+ openblas-lapack-pc
66+ jupyter_core
67+ ];
68+
69+ buildInputs = [
70+ gd
71+ readline
72+ ];
73+
74+ propagatedBuildInputs = [
75+ cypari2
76+ jinja2
77+ numpy
78+ pkgconfig
79+ boost
80+ arb
81+ brial
82+ cliquer
83+ ecl
84+ eclib
85+ ecm
86+ fflas-ffpack
87+ flint
88+ givaro
89+ glpk
90+ gsl
91+ lcalc
92+ libgap
93+ libmpc
94+ linbox
95+ lrcalc
96+ m4ri
97+ m4rie
98+ mpfi
99+ ntl
100+ openblasCompat
101+ pari
102+ planarity
103+ ppl
104+ pynac
105+ rankwidth
106+ ratpoints
107+ singular
108+ symmetrica
109+ zn_poly
110+ pip
111+ cython
112+ cysignals
113+ ];
114+
115+ buildPhase = ''
116+ export SAGE_ROOT="$PWD"
117+ export SAGE_LOCAL="$SAGE_ROOT"
118+ export SAGE_SHARE="$SAGE_LOCAL/share"
119+ export JUPYTER_PATH="$SAGE_LOCAL/jupyter"
120+
121+ export PATH="$SAGE_ROOT/build/bin:$SAGE_ROOT/src/bin:$PATH"
122+
123+ export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
124+
125+ mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
126+ mkdir -p "var/lib/sage/installed"
127+
128+ cd src
129+ source bin/sage-dist-helpers
130+
131+ ${python.interpreter} -u setup.py --no-user-cfg build
132+ '';
133+
134+ installPhase = ''
135+ ${python.interpreter} -u setup.py --no-user-cfg install --prefix=$out
136+
137+ rm -r "$out/${python.sitePackages}/sage/cython_debug"
138+ '';
139+}
pkgs/applications/science/math/sage/sagenb.nixnew file+49
@@ -0,0 +1,49 @@
1+# Has a cyclic dependency with sage (not expressed here) and is not useful outside of sage
2+{ stdenv
3+, fetchpatch
4+, python
5+, buildPythonPackage
6+, fetchFromGitHub
7+, mathjax
8+, twisted
9+, flask
10+, flask-oldsessions
11+, flask-openid
12+, flask-autoindex
13+, flask-babel
14+}:
15+
16+buildPythonPackage rec {
17+ pname = "sagenb";
18+ version = "2018-06-26"; # not 1.0.1 because of new flask syntax
19+
20+ src = fetchFromGitHub {
21+ owner = "sagemath";
22+ repo = "sagenb";
23+ rev = "b360a0172e15501fb0163d02dce713a561fee2af";
24+ sha256 = "12anydw0v9w23rbc0a94bqmjhjdir9h820c5zdhipw9ccdcc2jlf";
25+ };
26+
27+ propagatedBuildInputs = [
28+ twisted
29+ flask
30+ flask-oldsessions
31+ flask-openid
32+ flask-autoindex
33+ flask-babel
34+ ];
35+
36+ # tests depend on sage
37+ doCheck = false;
38+
39+ meta = with stdenv.lib; {
40+ description = "Sage Notebook";
41+ license = licenses.gpl3Plus;
42+ maintainers = with maintainers; [ timokau ];
43+ };
44+
45+ # let sagenb use mathjax
46+ postInstall = ''
47+ ln -s ${mathjax}/lib/node_modules/mathjax "$out/${python.sitePackages}/mathjax"
48+ '';
49+}
pkgs/applications/science/math/sage/shebangs.patchdeleted−36
@@ -1,36 +0,0 @@
1−diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg
2−index 83e61a7e0d..942ba206c7 100755
3−--- a/build/bin/sage-spkg
4−+++ b/build/bin/sage-spkg
5−@@ -648,8 +648,12 @@ if ! sage-apply-patches; then
6− error_msg "Error applying patches"
7− exit 1
8− fi
9−+
10−+@bash@/bin/bash @patchSageShebangs@ .
11−+
12− cd ..
13−
14−+
15− ##################################################################
16− # The package has been extracted, prepare for installation
17− ##################################################################
18−@@ -671,7 +675,7 @@ write_script_wrapper() {
19− local tmpscript="$(dirname "$script")/.tmp-${script##*/}"
20−
21− cat > "$tmpscript" <<__EOF__
22−-#!/usr/bin/env bash
23−+#! @bash@/bin/bash
24−
25− export SAGE_ROOT="$SAGE_ROOT"
26− export SAGE_SRC="$SAGE_SRC"
27−@@ -833,6 +837,9 @@ if [ "$UNAME" = "CYGWIN" ]; then
28− sage-rebase.sh "$SAGE_LOCAL" 2>/dev/null
29− fi
30−
31−+@bash@/bin/bash @patchSageShebangs@ .
32−+@bash@/bin/bash @patchSageShebangs@ "$out/bin"
33−+
34− echo "Successfully installed $PKG_NAME"
35−
36− if [ "$SAGE_CHECK" = "yes" ]; then
pkgs/applications/science/math/sage/spkg-giac.patchdeleted−20
@@ -1,20 +0,0 @@
1−diff --git a/build/pkgs/giac/spkg-install b/build/pkgs/giac/spkg-install
2−index bdd8df6cb8..3fd7a3ef8a 100644
3−--- a/build/pkgs/giac/spkg-install
4−+++ b/build/pkgs/giac/spkg-install
5−@@ -2,6 +2,15 @@
6− ## Giac
7− ###########################################
8−
9−+# Fix hardcoded paths, while making sure to only update timestamps of actually
10−+# changed files (otherwise confuses make)
11−+grep -rlF '/bin/cp' . | while read file
12−+do
13−+ sed -e 's@/bin/cp@cp@g' -i "$file"
14−+done
15−+
16−+# Fix input parser syntax
17−+sed -e 's@yylex (&yylval)@yylex (\&yyval, scanner)@gp' -i 'src/src/input_parser.cc'
18−
19− if [ "$SAGE_LOCAL" = "" ]; then
20− echo "SAGE_LOCAL undefined ... exiting";
pkgs/applications/science/math/sage/spkg-git.patchdeleted−18
@@ -1,18 +0,0 @@
1−diff --git a/build/pkgs/git/spkg-install b/build/pkgs/git/spkg-install
2−index 87874de3d8..b0906245fa 100644
3−--- a/build/pkgs/git/spkg-install
4−+++ b/build/pkgs/git/spkg-install
5−@@ -33,6 +33,13 @@ fi
6−
7− cd src
8−
9−+# Fix hardcoded paths, while making sure to only update timestamps of actually
10−+# changed files (otherwise confuses make)
11−+grep -rlF '/usr/bin/perl' . | while read file
12−+do
13−+ sed -e 's@/usr/bin/perl@perl@g' -i "$file"
14−+done
15−+
16− # We don't want to think about Fink or Macports
17− export NO_FINK=1
18− export NO_DARWIN_PORTS=1
pkgs/applications/science/math/sage/spkg-python.patchdeleted−13
@@ -1,13 +0,0 @@
1−diff --git a/build/pkgs/python3/spkg-build b/build/pkgs/python3/spkg-build
2−index 56db087ae5..b450703c5f 100644
3−--- a/build/pkgs/python3/spkg-build
4−+++ b/build/pkgs/python3/spkg-build
5−@@ -27,6 +27,8 @@ fi
6− export EXTRA_CFLAGS="`testcflags.sh -Wno-unused` $CFLAGS"
7− unset CFLAGS
8−
9−+export LDFLAGS="$LDFLAGS -lcrypt"
10−+
11− if [ "$UNAME" = Darwin ]; then
12− PYTHON_CONFIGURE="--disable-toolbox-glue $PYTHON_CONFIGURE"
13−
pkgs/applications/science/math/sage/spkg-singular.patchdeleted−18
@@ -1,18 +0,0 @@
1−diff --git a/build/pkgs/singular/spkg-install b/build/pkgs/singular/spkg-install
2−index 8caafb1699..3c34e6608a 100644
3−--- a/build/pkgs/singular/spkg-install
4−+++ b/build/pkgs/singular/spkg-install
5−@@ -2,6 +2,13 @@
6− ## Singular
7− ###########################################
8−
9−+# Fix hardcoded paths, while making sure to only update timestamps of actually
10−+# changed files (otherwise confuses make)
11−+grep -rlF '/bin/rm' . | while read file
12−+do
13−+ sed -e 's@/bin/rm@rm@g' -i "$file"
14−+done
15−+
16− if [ -z "$SAGE_LOCAL" ]; then
17− echo >&2 "Error: SAGE_LOCAL undefined -- exiting..."
18− echo >&2 "Maybe run 'sage -sh'?"
pkgs/top-level/all-packages.nix+4−1
@@ -20381,7 +20381,10 @@ with pkgs;
2038120381
2038220382 petsc = callPackage ../development/libraries/science/math/petsc { };
2038320383
20384− sage = callPackage ../applications/science/math/sage { };
20384+ sage = callPackage ../applications/science/math/sage {
20385+ nixpkgs = pkgs;
20386+ };
20387+ sageWithDoc = sage.override { withDoc = true; };
2038520388
2038620389 suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { };
2038720390 suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {};