git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #39981 from timokau/sage-on-nixos

Sage on nixos

commit055a29c4a1b8d8f0fed38bb82fa86a7b97adfdb7 authorMichael Raskin <7c6f434c@mail.ru> dateSun 1 Jul 2018, 07:37 (8 years ago) parent060a98e70ba695
63 files changed+4011−485
pkgs/applications/science/math/sage/README.md+117 pkgs/applications/science/math/sage/default.nix+202−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/arb-2.13.0.patch+427 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/pynac-0.7.22.patch+479 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/test-in-tmpdir.patch+31 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+205 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/applications/science/math/symmetrica/default.nix+20−3 pkgs/build-support/fetchurl/mirrors.nix+31−34 pkgs/data/misc/combinatorial_designs/default.nix+31 pkgs/data/misc/conway_polynomials/default.nix+43 pkgs/data/misc/elliptic_curves/default.nix+51 pkgs/data/misc/graphs/default.nix+26 pkgs/data/misc/pari-galdata/default.nix+26 pkgs/data/misc/pari-seadata-small/default.nix+26 pkgs/data/misc/polytopes_db/default.nix+26 pkgs/development/compilers/ecl/16.1.2.nix+8 pkgs/development/libraries/arb/default.nix+9−1 pkgs/development/libraries/libgap/default.nix+10−3 pkgs/development/libraries/linbox/default.nix−3 pkgs/development/libraries/science/math/lcalc/default.nix+1−1 pkgs/development/libraries/science/math/openblas/default.nix+2−3 pkgs/development/libraries/science/math/rankwidth/default.nix+1−1 pkgs/development/libraries/science/math/rubiks/default.nix+1−1 pkgs/development/libraries/science/math/sympow/default.nix+2−2 pkgs/development/libraries/tachyon/default.nix+1 pkgs/development/python-modules/cysignals/default.nix+9−1 pkgs/development/python-modules/flask-autoindex/default.nix+10−15 pkgs/development/python-modules/flask-silk/default.nix+9−5 pkgs/development/python-modules/sympy/default.nix+18−1 pkgs/top-level/all-packages.nix+36−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+202−221
@@ -1,230 +1,211 @@
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+ };
43+
44+ sagenb = self.callPackage ./sagenb.nix {
45+ mathjax = nodePackages_8_x.mathjax;
46+ };
47+
48+ sagedoc = self.callPackage ./sagedoc.nix {
49+ inherit sage-src;
50+ };
51+
52+ env-locations = self.callPackage ./env-locations.nix {
53+ inherit pari_data ecl pari;
54+ inherit singular;
55+ three = nodePackages_8_x.three;
56+ mathjax = nodePackages_8_x.mathjax;
57+ };
58+
59+ sage-env = self.callPackage ./sage-env.nix {
60+ inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv;
61+ pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
62+ };
63+
64+ sage-with-env = self.callPackage ./sage-with-env.nix {
65+ inherit pari eclib pythonEnv;
66+ inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
67+ pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
68+ three = nodePackages_8_x.three;
69+ };
70+
71+ sage = self.callPackage ./sage.nix { };
72+
73+ sage-wrapper = self.callPackage ./sage-wrapper.nix {
74+ inherit sage-src withDoc;
75+ };
76+ };
8177 };
8278
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
79+ openblas-blas-pc = callPackage ./openblas-pc.nix { name = "blas"; };
80+ openblas-cblas-pc = callPackage ./openblas-pc.nix { name = "cblas"; };
81+ openblas-lapack-pc = callPackage ./openblas-pc.nix { name = "lapack"; };
82+
83+ sage-src = callPackage ./sage-src.nix {};
84+
85+ pythonRuntimeDeps = with python.pkgs; [
86+ sagelib
87+ pybrial
88+ sagenb
89+ cvxopt
90+ networkx
91+ service-identity
92+ psutil
93+ sympy
94+ fpylll
95+ matplotlib
96+ scipy
97+ ipywidgets
98+ rpy2
99+ sphinx
100+ typing
101+ pillow
131102 ];
132103
133− enableParallelBuilding = true;
104+ pythonEnv = python.buildEnv.override {
105+ extraLibs = pythonRuntimeDeps;
106+ ignoreCollisions = true;
107+ } // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible
108+
109+ # needs to be rWrapper, standard "R" doesn't include default packages
110+ rWrapper = nixpkgs.rWrapper.override {
111+ # https://trac.sagemath.org/ticket/25674
112+ R = nixpkgs.R.overrideAttrs (attrs: rec {
113+ name = "R-3.4.4";
114+ src = fetchurl {
115+ url = "http://cran.r-project.org/src/base/R-3/${name}.tar.gz";
116+ sha256 = "0dq3jsnwsb5j3fhl0wi3p5ycv8avf8s5j1y4ap3d2mkjmcppvsdk";
117+ };
118+ });
119+ };
134120
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− ];
121+ # update causes issues
122+ # https://groups.google.com/forum/#!topic/sage-packaging/cS3v05Q0zso
123+ # https://trac.sagemath.org/ticket/24735
124+ singular = nixpkgs.singular.overrideAttrs (oldAttrs: {
125+ name = "singular-4.1.0p3";
126+ src = fetchurl {
127+ url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-1-0/singular-4.1.0p3.tar.gz";
128+ sha256 = "105zs3zk46b1cps403ap9423rl48824ap5gyrdgmg8fma34680a4";
129+ };
130+ });
131+
132+ # *not* to confuse with the python package "pynac"
133+ # https://trac.sagemath.org/ticket/24838 (depends on arb update)
134+ pynac = nixpkgs.pynac.override { inherit singular; };
135+
136+ eclib = nixpkgs.eclib.override { inherit pari; };
137+
138+ # With openblas (64 bit), the tests fail the same way as when sage is build with
139+ # openblas instead of openblasCompat. Apparently other packages somehow use flints
140+ # blas when it is available. Alternative would be to override flint to use
141+ # openblasCompat.
142+ flint = nixpkgs.flint.override { withBlas = false; };
143+
144+ # Multiple palp dimensions need to be available and sage expects them all to be
145+ # in the same folder.
146+ palp = symlinkJoin {
147+ name = "palp-${nixpkgs.palp.version}";
148+ paths = [
149+ (nixpkgs.palp.override { dimensions = 4; doSymlink = false; })
150+ (nixpkgs.palp.override { dimensions = 5; doSymlink = false; })
151+ (nixpkgs.palp.override { dimensions = 6; doSymlink = true; })
152+ (nixpkgs.palp.override { dimensions = 11; doSymlink = false; })
153+ ];
154+ };
139155
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 ];
156+ # Sage expects those in the same directory.
157+ pari_data = symlinkJoin {
158+ name = "pari_data";
159+ paths = with nixpkgs; [
160+ pari-galdata
161+ pari-seadata-small
162+ ];
229163 };
230−}
164+
165+ # https://trac.sagemath.org/ticket/22191
166+ ecl = nixpkgs.ecl_16_1_2;
167+
168+ # sage currently uses an unreleased version of pari
169+ pari = (nixpkgs.pari.override { withThread = false; }).overrideAttrs (attrs: rec {
170+ version = "2.10-1280-g88fb5b3"; # on update remove pari-stackwarn patch from `sage-src.nix`
171+ src = fetchurl {
172+ url = "mirror://sageupstream/pari/pari-${version}.tar.gz";
173+ sha256 = "19gbsm8jqq3hraanbmsvzkbh88iwlqbckzbnga3y76r7k42akn7m";
174+ };
175+ });
176+
177+ # https://trac.sagemath.org/ticket/24824
178+ glpk = nixpkgs.glpk.overrideAttrs (attrs: rec {
179+ version = "4.63";
180+ name = "glpk-${version}";
181+ src = fetchurl {
182+ url = "mirror://gnu/glpk/${name}.tar.gz";
183+ sha256 = "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci";
184+ };
185+ patches = (attrs.patches or []) ++ [
186+ # Alternatively patch sage with debians
187+ # https://sources.debian.org/data/main/s/sagemath/8.1-7/debian/patches/t-version-glpk-4.60-extra-hack-fixes.patch
188+ # The header of that debian patch contains a good description of the issue. The gist of it:
189+ # > If GLPK in Sage causes one error, and this is caught by Sage and recovered from, then
190+ # > later (because upstream GLPK does not clear the "error" flag) Sage will append
191+ # > all subsequent terminal output of GLPK into the error_message string but not
192+ # > actually forward it to the user's terminal. This breaks some doctests.
193+ (fetchpatch {
194+ name = "error_recovery.patch";
195+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/error_recovery.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
196+ sha256 = "0z99z9gd31apb6x5n5n26411qzx0ma3s6dnznc4x61x86bhq31qf";
197+ })
198+
199+ # Allow setting a exact verbosity level (OFF|ERR|ON|ALL|DBG)
200+ (fetchpatch {
201+ name = "exact_verbosity.patch";
202+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/glp_exact_verbosity.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
203+ sha256 = "15gm5i2alqla3m463i1qq6jx6c0ns6lip7njvbhp37pgxg4s9hx8";
204+ })
205+ ];
206+ });
207+in
208+ python.pkgs.sage-wrapper // {
209+ doc = python.pkgs.sagedoc;
210+ lib = python.pkgs.sagelib;
211+ }
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/arb-2.13.0.patchnew file+427
@@ -0,0 +1,427 @@
1+commit c885927e25b29bd23869e02379c2918da430323e
2+Author: Timo Kaufmann <timokau@zoho.com>
3+Date: Sat Jun 30 02:26:15 2018 +0200
4+
5+diff --git a/build/pkgs/arb/checksums.ini b/build/pkgs/arb/checksums.ini
6+index 1924ee03c3..9323b97391 100644
7+--- a/build/pkgs/arb/checksums.ini
8++++ b/build/pkgs/arb/checksums.ini
9+@@ -1,4 +1,4 @@
10+ tarball=arb-VERSION.tar.gz
11+-sha1=27476d0529e48a07d92da90bd0fb80dd18f443e3
12+-md5=733285d9705d10b8024e551ffa81952f
13+-cksum=2391183744
14++sha1=44eda7bf8eaa666c45b1fc2c1b5bd08756d94b58
15++md5=fa24de9fffe4394fb6a7a6792e2ecc5f
16++cksum=3689220688
17+diff --git a/build/pkgs/arb/package-version.txt b/build/pkgs/arb/package-version.txt
18+index c8810e9bdb..fb2c0766b7 100644
19+--- a/build/pkgs/arb/package-version.txt
20++++ b/build/pkgs/arb/package-version.txt
21+@@ -1 +1 @@
22+-2.12.0.p0
23++2.13.0
24+diff --git a/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch b/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch
25+deleted file mode 100644
26+index 3e5c0e708b..0000000000
27+--- a/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch
28++++ /dev/null
29+@@ -1,17 +0,0 @@
30+-In newer binutils, ld options -r and -pie conflict.
31+-Patch due to Jörg-Volker Peetz
32+-(source : https://groups.google.com/d/msg/sage-devel/TduebNoZuBE/sEULolL0BQAJ),
33+-packaged by Emmanuel Charpentier
34+-
35+-diff -ru arb-2.8.1-orig/Makefile.subdirs arb-2.8.1-new/Makefile.subdirs
36+---- arb-2.8.1-orig/Makefile.subdirs 2015-12-31 17:30:01.000000000 +0100
37+-+++ arb-2.8.1-new/Makefile.subdirs 2016-11-07 18:50:34.540051779 +0100
38+-@@ -52,7 +52,7 @@
39+- $(QUIET_CC) $(CC) $(CFLAGS) $(INCS) -c $< -o $@ -MMD -MP -MF "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$@"
40+-
41+- $(MOD_LOBJ): $(LOBJS)
42+-- $(QUIET_CC) $(CC) $(ABI_FLAG) -Wl,-r $^ -o $@ -nostdlib
43+-+ $(QUIET_CC) $(CC) $(ABI_FLAG) -r $^ -o $@ -nostdlib
44+-
45+- -include $(LOBJS:.lo=.d)
46+-
47+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
48+index 70d51e655a..00e7caea2c 100644
49+--- a/src/sage/rings/complex_arb.pyx
50++++ b/src/sage/rings/complex_arb.pyx
51+@@ -857,14 +857,14 @@ class ComplexBallField(UniqueRepresentation, Field):
52+ [0.500000000000000 +/- 2.09e-16]
53+
54+ sage: CBF.integral(lambda x, _: x.gamma(), 1 - CBF(i), 1 + CBF(i))
55+- [+/- 3.95e-15] + [1.5723926694981 +/- 4.53e-14]*I
56++ [+/- 4...e-15] + [1.5723926694981 +/- 4...e-14]*I
57+
58+ sage: C = ComplexBallField(100)
59+ sage: C.integral(lambda x, _: x.cos() * x.sin(), 0, 1)
60+ [0.35403670913678559674939205737 +/- 8.89e-30]
61+
62+ sage: CBF.integral(lambda x, _: (x + x.exp()).sin(), 0, 8)
63+- [0.34740017266 +/- 6.36e-12]
64++ [0.34740017266 +/- 6...e-12]
65+
66+ sage: C = ComplexBallField(2000)
67+ sage: C.integral(lambda x, _: (x + x.exp()).sin(), 0, 8) # long time
68+@@ -879,14 +879,14 @@ class ComplexBallField(UniqueRepresentation, Field):
69+ ....: else:
70+ ....: return z.sqrt()
71+ sage: CBF.integral(my_sqrt, -1 + CBF(i), -1 - CBF(i))
72+- [+/- 1.14e-14] + [-0.4752076627926 +/- 5.18e-14]*I
73++ [+/- 1.14e-14] + [-0.4752076627926 +/- 5...e-14]*I
74+
75+ Note, though, that proper handling of the ``analytic`` flag is required
76+ even when the path does not touch the branch cut::
77+
78+ sage: correct = CBF.integral(my_sqrt, 1, 2); correct
79+ [1.21895141649746 +/- 3.73e-15]
80+- sage: RBF(integral(sqrt(x), x, 1, 2))
81++ sage: RBF(integral(sqrt(x), x, 1, 2)) # long time
82+ [1.21895141649746 +/- 1.79e-15]
83+ sage: wrong = CBF.integral(lambda z, _: z.sqrt(), 1, 2) # WRONG!
84+ sage: correct - wrong
85+@@ -915,9 +915,9 @@ class ComplexBallField(UniqueRepresentation, Field):
86+ the integrand is unbounded::
87+
88+ sage: CBF.integral(lambda x, _: 1/x, -1, 1)
89+- [+/- inf] + [+/- inf]*I
90++ nan + nan*I
91+ sage: CBF.integral(lambda x, _: 1/x, 10^-1000, 1)
92+- [+/- inf] + [+/- inf]*I
93++ nan + nan*I
94+ sage: CBF.integral(lambda x, _: 1/x, 10^-1000, 1, abs_tol=1e-10)
95+ [2302.5850930 +/- 1.26e-8]
96+
97+@@ -928,14 +928,15 @@ class ComplexBallField(UniqueRepresentation, Field):
98+ sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, abs_tol=1e-450)
99+ [2.304377150950e-439 +/- 9.74e-452]
100+ sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, abs_tol=0)
101+- [2.304377150949e-439 +/- 7.53e-452]
102+- sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, rel_tol=1e-4, abs_tol=0)
103+- [2.30438e-439 +/- 3.90e-445]
104++ [2.304377150950e-439 +/- 7...e-452]
105++ sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, rel_tol=1e-2, abs_tol=0)
106++ [2.30438e-439 +/- 5.94e-445]
107+
108+- sage: CBF.integral(lambda x, _: x*(1/x).sin(), 0, 1)
109+- [+/- 0.644]
110+- sage: CBF.integral(lambda x, _: x*(1/x).sin(), 0, 1, use_heap=True)
111+- [0.3785300 +/- 4.32e-8]
112++ sage: epsi = CBF(1e-10)
113++ sage: CBF.integral(lambda x, _: x*(1/x).sin(), epsi, 1)
114++ [0.38 +/- 8.54e-3]
115++ sage: CBF.integral(lambda x, _: x*(1/x).sin(), epsi, 1, use_heap=True)
116++ [0.37853002 +/- 8.73e-9]
117+
118+ ALGORITHM:
119+
120+@@ -951,12 +952,12 @@ class ComplexBallField(UniqueRepresentation, Field):
121+
122+ sage: i = QuadraticField(-1).gen()
123+ sage: CBF.integral(lambda x, _: (1 + i*x).gamma(), -1, 1)
124+- [1.5723926694981 +/- 4.53e-14] + [+/- 3.95e-15]*I
125++ [1.5723926694981 +/- 4...e-14] + [+/- 4...e-15]*I
126+
127+- sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, rel_tol=1e-400)
128+- [0.459... +/- ...e-4...]
129++ sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, rel_tol=1e-300)
130++ [0.459... +/- ...e-3...]
131+ sage: CBF.integral(lambda x, _: x.sin(), 0, 100, rel_tol=10)
132+- [+/- 7.61]
133++ [0.138 +/- 5.53e-4]
134+
135+ sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, abs_tol=1e-400)
136+ [0.459697... +/- ...e-4...]
137+@@ -2389,9 +2390,9 @@ cdef class ComplexBall(RingElement):
138+ sage: ~CBF(i/3)
139+ [-3.00000000000000 +/- 9.44e-16]*I
140+ sage: ~CBF(0)
141+- [+/- inf]
142++ nan
143+ sage: ~CBF(RIF(10,11))
144+- [0.1 +/- 9.53e-3]
145++ [0.1 +/- 9.10e-3]
146+ """
147+ cdef ComplexBall res = self._new()
148+ if _do_sig(prec(self)): sig_on()
149+@@ -2512,9 +2513,9 @@ cdef class ComplexBall(RingElement):
150+ sage: CBF(-2, 1)/CBF(1, 1/3)
151+ [-1.500000000000000 +/- 8.83e-16] + [1.500000000000000 +/- 5.64e-16]*I
152+ sage: CBF(2+I)/CBF(0)
153+- [+/- inf] + [+/- inf]*I
154++ nan + nan*I
155+ sage: CBF(1)/CBF(0)
156+- [+/- inf]
157++ nan
158+ sage: CBF(1)/CBF(RBF(0, 1.))
159+ nan
160+ """
161+@@ -2543,9 +2544,9 @@ cdef class ComplexBall(RingElement):
162+ sage: CBF(0)^(1/3)
163+ 0
164+ sage: CBF(0)^(-1)
165+- [+/- inf]
166++ nan
167+ sage: CBF(0)^(-2)
168+- [+/- inf] + [+/- inf]*I
169++ nan + nan*I
170+
171+ TESTS::
172+
173+@@ -2656,12 +2657,12 @@ cdef class ComplexBall(RingElement):
174+ sage: CBF(1).rising_factorial(5)
175+ 120.0000000000000
176+ sage: CBF(1/3, 1/2).rising_factorial(300)
177+- [-3.87949484514e+612 +/- 5.23e+600] + [-3.52042209763e+612 +/- 5.55e+600]*I
178++ [-3.87949484514e+612 +/- 5...e+600] + [-3.52042209763e+612 +/- 5...e+600]*I
179+
180+ sage: CBF(1).rising_factorial(-1)
181+ nan
182+ sage: CBF(1).rising_factorial(2**64)
183+- [+/- 2.30e+347382171305201370464]
184++ [+/- 2.30e+347382171326740403407]
185+ sage: ComplexBallField(128)(1).rising_factorial(2**64)
186+ [2.343691126796861348e+347382171305201285713 +/- 4.71e+347382171305201285694]
187+ sage: CBF(1/2).rising_factorial(CBF(2,3))
188+@@ -2700,7 +2701,7 @@ cdef class ComplexBall(RingElement):
189+ [1.000000000000000 +/- 2.83e-16] + [-0.441271200305303 +/- 2.82e-16]*I
190+
191+ sage: CBF('inf').log()
192+- nan + nan*I
193++ [+/- inf]
194+ sage: CBF(2).log(0)
195+ nan + nan*I
196+ """
197+@@ -2808,7 +2809,7 @@ cdef class ComplexBall(RingElement):
198+ sage: CBF(pi/2, 1/10).tan()
199+ [+/- 2.87e-14] + [10.0333111322540 +/- 2.36e-14]*I
200+ sage: CBF(pi/2).tan()
201+- [+/- inf]
202++ nan
203+ """
204+ cdef ComplexBall res = self._new()
205+ if _do_sig(prec(self)): sig_on()
206+@@ -2825,7 +2826,7 @@ cdef class ComplexBall(RingElement):
207+ sage: CBF(pi, 1/10).cot()
208+ [+/- 5.74e-14] + [-10.0333111322540 +/- 2.81e-14]*I
209+ sage: CBF(pi).cot()
210+- [+/- inf]
211++ nan
212+ """
213+ cdef ComplexBall res = self._new()
214+ if _do_sig(prec(self)): sig_on()
215+@@ -3211,9 +3212,9 @@ cdef class ComplexBall(RingElement):
216+ 1.000000000000000*I
217+
218+ sage: CBF(2+3*I).hypergeometric([1/4,1/3],[1/2])
219+- [0.7871684267473 +/- 7.34e-14] + [0.2749254173721 +/- 9.23e-14]*I
220++ [0.7871684267473 +/- 7...e-14] + [0.2749254173721 +/- 9...e-14]*I
221+ sage: CBF(2+3*I).hypergeometric([1/4,1/3],[1/2],regularized=True)
222+- [0.4441122268685 +/- 3.96e-14] + [0.1551100567338 +/- 5.75e-14]*I
223++ [0.4441122268685 +/- 3...e-14] + [0.1551100567338 +/- 5...e-14]*I
224+
225+ sage: CBF(5).hypergeometric([2,3], [-5])
226+ nan + nan*I
227+@@ -4041,9 +4042,9 @@ cdef class ComplexBall(RingElement):
228+
229+ sage: phi = CBF(1,1)
230+ sage: (CBF.pi()/2).elliptic_e_inc(phi)
231+- [1.283840957898 +/- 3.23e-13] + [-0.5317843366915 +/- 7.79e-14]*I
232++ [1.283840957898 +/- 3...e-13] + [-0.5317843366915 +/- 7...e-14]*I
233+ sage: phi.elliptic_e()
234+- [1.2838409578982 +/- 5.90e-14] + [-0.5317843366915 +/- 3.35e-14]*I
235++ [1.2838409578982 +/- 5...e-14] + [-0.5317843366915 +/- 3...e-14]*I
236+
237+ sage: phi = CBF(2, 3/7)
238+ sage: (CBF.pi()/2).elliptic_e_inc(phi)
239+@@ -4312,8 +4313,7 @@ cdef class ComplexBall(RingElement):
240+ sage: CBF(10).laguerre_L(3, 2)
241+ [-6.666666666667 +/- 4.15e-13]
242+ sage: CBF(5,7).laguerre_L(CBF(2,3), CBF(1,-2))
243+- [5515.315030271 +/- 4.37e-10] + [-12386.942845271 +/- 5.47e-10]*I
244+-
245++ [5515.315030271 +/- 4...e-10] + [-12386.942845271 +/- 5...e-10]*I
246+ """
247+ cdef ComplexBall my_n = self._parent.coerce(n)
248+ cdef ComplexBall my_m = self._parent.coerce(m)
249+@@ -4357,9 +4357,9 @@ cdef class ComplexBall(RingElement):
250+ EXAMPLES::
251+
252+ sage: CBF(1/2).legendre_P(5)
253+- [0.08984375000000000 +/- 4.5...e-18]
254++ [0.0898437500000000 +/- 7...e-17]
255+ sage: CBF(1,2).legendre_P(CBF(2,3), CBF(0,1))
256+- [0.10996180744364 +/- 7.45e-15] + [0.14312767804055 +/- 8.38e-15]*I
257++ [0.10996180744364 +/- 7.12e-15] + [0.14312767804055 +/- 8.07e-15]*I
258+ sage: CBF(-10).legendre_P(5, 325/100)
259+ [-22104403.487377 +/- 6.81e-7] + [53364750.687392 +/- 7.25e-7]*I
260+ sage: CBF(-10).legendre_P(5, 325/100, type=3)
261+@@ -4393,9 +4393,9 @@ cdef class ComplexBall(RingElement):
262+ sage: CBF(1/2).legendre_Q(5)
263+ [0.55508089057168 +/- 2.79e-15]
264+ sage: CBF(1,2).legendre_Q(CBF(2,3), CBF(0,1))
265+- [0.167678710 +/- 4.60e-10] + [-0.161558598 +/- 7.47e-10]*I
266++ [0.167678710 +/- 3.91e-10] + [-0.161558598 +/- 6.77e-10]*I
267+ sage: CBF(-10).legendre_Q(5, 325/100)
268+- [-83825154.36008 +/- 4.94e-6] + [-34721515.80396 +/- 5.40e-6]*I
269++ [-83825154.36008 +/- 5.02e-6] + [-34721515.80396 +/- 5.42e-6]*I
270+ sage: CBF(-10).legendre_Q(5, 325/100, type=3)
271+ [-4.797306921692e-6 +/- 6.82e-19] + [-4.797306921692e-6 +/- 6.57e-19]*I
272+
273+diff --git a/src/sage/rings/polynomial/polynomial_complex_arb.pyx b/src/sage/rings/polynomial/polynomial_complex_arb.pyx
274+index c436d4705b..ef611a566b 100644
275+--- a/src/sage/rings/polynomial/polynomial_complex_arb.pyx
276++++ b/src/sage/rings/polynomial/polynomial_complex_arb.pyx
277+@@ -543,7 +543,7 @@ cdef class Polynomial_complex_arb(Polynomial):
278+ sage: (1 - x/3).inverse_series_trunc(3)
279+ ([0.1111111111111111 +/- 5.99e-17])*x^2 + ([0.3333333333333333 +/- 7.04e-17])*x + 1.000000000000000
280+ sage: x.inverse_series_trunc(1)
281+- [+/- inf]
282++ nan
283+ sage: Pol(0).inverse_series_trunc(2)
284+ (nan + nan*I)*x + nan + nan*I
285+
286+@@ -671,7 +671,7 @@ cdef class Polynomial_complex_arb(Polynomial):
287+ sage: pol._sqrt_series(2)
288+ ([+/- 7.51e-3] + [+/- 0.501]*I)*x + [+/- 5.01e-3] + [+/- 1.01]*I
289+ sage: x._sqrt_series(2)
290+- ([+/- inf] + [+/- inf]*I)*x
291++ (nan + nan*I)*x
292+ """
293+ cdef Polynomial_complex_arb res = self._new()
294+ if n < 0:
295+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
296+index c9f68e38d7..76e3037a9a 100644
297+--- a/src/sage/rings/real_arb.pyx
298++++ b/src/sage/rings/real_arb.pyx
299+@@ -161,7 +161,7 @@ values and should be preferred::
300+
301+ sage: RBF(NaN) < RBF(infinity)
302+ False
303+- sage: 1/RBF(0) <= RBF(infinity)
304++ sage: RBF(0).add_error(infinity) <= RBF(infinity)
305+ True
306+
307+ TESTS::
308+@@ -252,6 +252,8 @@ cdef void mpfi_to_arb(arb_t target, const mpfi_t source, const long precision):
309+ (+infinity, +infinity)
310+ sage: RBF(RIF(-infinity)).endpoints()
311+ (-infinity, -infinity)
312++ sage: RBF(RIF(-infinity, infinity)).endpoints()
313++ (-infinity, +infinity)
314+ sage: RIF(RBF(infinity)).endpoints()
315+ (+infinity, +infinity)
316+ sage: RIF(RBF(-infinity)).endpoints()
317+@@ -266,10 +268,11 @@ cdef void mpfi_to_arb(arb_t target, const mpfi_t source, const long precision):
318+ if _do_sig(precision): sig_on()
319+ mpfi_get_left(left, source)
320+ mpfi_get_right(right, source)
321+- arb_set_interval_mpfr(target, left, right, precision)
322+- # Work around weakness of arb_set_interval_mpfr(tgt, inf, inf)
323+- if mpfr_equal_p(left, right):
324+- mag_zero(arb_radref(target))
325++ if mpfr_inf_p(left) and mpfr_inf_p(right) and mpfr_sgn(left) < 0 < mpfr_sgn(right):
326++ # Work around a weakness of arb_set_interval_mpfr(tgt, -inf, inf)
327++ arb_zero_pm_inf(target)
328++ else:
329++ arb_set_interval_mpfr(target, left, right, precision)
330+ if _do_sig(precision): sig_off()
331+
332+ mpfr_clear(left)
333+@@ -649,17 +652,15 @@ class RealBallField(UniqueRepresentation, Field):
334+ EXAMPLES::
335+
336+ sage: RBF.some_elements()
337+- [1.000000000000000,
338+- [0.3333333333333333 +/- 7.04e-17],
339++ [0, 1.000000000000000, [0.3333333333333333 +/- 7.04e-17],
340+ [-4.733045976388941e+363922934236666733021124 +/- 3.46e+363922934236666733021108],
341+- [+/- inf],
342+- [+/- inf],
343+- nan]
344++ [+/- inf], [+/- inf], [+/- inf], nan]
345+ """
346+ import sage.symbolic.constants
347+- return [self(1), self(1)/3,
348++ inf = self(sage.rings.infinity.Infinity)
349++ return [self(0), self(1), self(1)/3,
350+ -self(2)**(Integer(2)**80),
351+- self(sage.rings.infinity.Infinity), ~self(0),
352++ inf, -inf, self.zero().add_error(inf),
353+ self.element_class(self, sage.symbolic.constants.NotANumber())]
354+
355+ def _sum_of_products(self, terms):
356+@@ -881,7 +882,7 @@ class RealBallField(UniqueRepresentation, Field):
357+ sage: RBF.gamma(5)
358+ 24.00000000000000
359+ sage: RBF.gamma(10**20)
360+- [+/- 5.92e+1956570551809674821757]
361++ [+/- 5.50e+1956570552410610660600]
362+ sage: RBF.gamma(1/3)
363+ [2.678938534707747 +/- 8.99e-16]
364+ sage: RBF.gamma(-5)
365+@@ -2247,7 +2248,7 @@ cdef class RealBall(RingElement):
366+ sage: inf = RBF(+infinity)
367+ sage: other_inf = RBF(+infinity, 42.r)
368+ sage: neg_inf = RBF(-infinity)
369+- sage: extended_line = 1/RBF(0)
370++ sage: extended_line = RBF(0).add_error(infinity)
371+ sage: exact_nan = inf - inf
372+ sage: exact_nan.mid(), exact_nan.rad()
373+ (NaN, 0.00000000)
374+@@ -2659,7 +2660,7 @@ cdef class RealBall(RingElement):
375+ sage: ~RBF(5)
376+ [0.2000000000000000 +/- 4.45e-17]
377+ sage: ~RBF(0)
378+- [+/- inf]
379++ nan
380+ sage: RBF(RIF(-0.1,0.1))
381+ [+/- 0.101]
382+
383+@@ -2739,7 +2740,7 @@ cdef class RealBall(RingElement):
384+ sage: RBF(pi)/RBF(e)
385+ [1.155727349790922 +/- 8.43e-16]
386+ sage: RBF(2)/RBF(0)
387+- [+/- inf]
388++ nan
389+ """
390+ cdef RealBall res = self._new()
391+ if _do_sig(prec(self)): sig_on()
392+@@ -2765,7 +2766,7 @@ cdef class RealBall(RingElement):
393+ sage: RBF(-1)^(1/3)
394+ nan
395+ sage: RBF(0)^(-1)
396+- [+/- inf]
397++ nan
398+ sage: RBF(-e)**RBF(pi)
399+ nan
400+
401+@@ -3129,7 +3130,7 @@ cdef class RealBall(RingElement):
402+ sage: RBF(1).tan()
403+ [1.557407724654902 +/- 3.26e-16]
404+ sage: RBF(pi/2).tan()
405+- [+/- inf]
406++ nan
407+ """
408+ cdef RealBall res = self._new()
409+ if _do_sig(prec(self)): sig_on()
410+@@ -3146,7 +3147,7 @@ cdef class RealBall(RingElement):
411+ sage: RBF(1).cot()
412+ [0.642092615934331 +/- 4.79e-16]
413+ sage: RBF(pi).cot()
414+- [+/- inf]
415++ nan
416+ """
417+ cdef RealBall res = self._new()
418+ if _do_sig(prec(self)): sig_on()
419+@@ -3257,7 +3258,7 @@ cdef class RealBall(RingElement):
420+ sage: RBF(1).coth()
421+ [1.313035285499331 +/- 4.97e-16]
422+ sage: RBF(0).coth()
423+- [+/- inf]
424++ nan
425+ """
426+ cdef RealBall res = self._new()
427+ if _do_sig(prec(self)): sig_on()
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/pynac-0.7.22.patchnew file+479
@@ -0,0 +1,479 @@
1+diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py
2+index 3a417d9d5c..fadaadbaf6 100644
3+--- a/src/sage/calculus/calculus.py
4++++ b/src/sage/calculus/calculus.py
5+@@ -231,7 +231,7 @@ Another example::
6+ sage: f(x=3)
7+ arcsinh(1)
8+ sage: f.derivative(x)
9+- 1/3/sqrt(1/9*x^2 + 1)
10++ 1/sqrt(x^2 + 9)
11+
12+ We compute the length of the parabola from 0 to 2::
13+
14+@@ -1509,8 +1509,8 @@ def laplace(ex, t, s, algorithm='maxima'):
15+ Testing SymPy::
16+
17+ sage: laplace(t^n, t, s, algorithm='sympy')
18+- (s^(-n)*gamma(n + 1)/s, 0, -re(n) < 1)
19+-
20++ (gamma(n + 1)/(s*s^n), 0, -re(n) < 1)
21++
22+ Testing Maxima::
23+
24+ sage: laplace(t^n, t, s, algorithm='maxima')
25+diff --git a/src/sage/functions/hypergeometric.py b/src/sage/functions/hypergeometric.py
26+index 1fc2db5c94..f3e49b9cdb 100644
27+--- a/src/sage/functions/hypergeometric.py
28++++ b/src/sage/functions/hypergeometric.py
29+@@ -34,7 +34,7 @@ Simplification (note that ``simplify_full`` does not yet call
30+ sage: a.simplify_hypergeometric()
31+ 1/((-e^x + 1)^e^x)
32+ sage: a.simplify_hypergeometric(algorithm='sage')
33+- (-e^x + 1)^(-e^x)
34++ 1/((-e^x + 1)^e^x)
35+
36+ Equality testing::
37+
38+@@ -145,7 +145,7 @@ Series expansions of confluent hypergeometric functions::
39+
40+ sage: hypergeometric_M(2, 2, x).series(x, 3)
41+ 1 + 1*x + 1/2*x^2 + Order(x^3)
42+- sage: hypergeometric_U(2, 2, x).series(x == 3, 100).subs(x=1).n()
43++ sage: hypergeometric_U(2, 2, x).series(x == 3, 100).subs(x=1).n() # known bug (see :trac:`25688`)
44+ 0.403652637676806
45+ sage: hypergeometric_U(2, 2, 1).n()
46+ 0.403652637676806
47+@@ -773,7 +773,7 @@ def closed_form(hyp):
48+ sage: closed_form(hypergeometric([], [], z))
49+ e^z
50+ sage: closed_form(hypergeometric([a], [], z))
51+- (-z + 1)^(-a)
52++ 1/((-z + 1)^a)
53+ sage: closed_form(hypergeometric([1, 1, 2], [1, 1], z))
54+ (z - 1)^(-2)
55+ sage: closed_form(hypergeometric([2, 3], [1], x))
56+@@ -1121,7 +1121,7 @@ class Hypergeometric_U(BuiltinFunction):
57+ sage: var('a b z')
58+ (a, b, z)
59+ sage: hypergeometric_U(a, b, z).generalized()
60+- z^(-a)*hypergeometric((a, a - b + 1), (), -1/z)
61++ hypergeometric((a, a - b + 1), (), -1/z)/z^a
62+ sage: hypergeometric_U(1, 3, 1/2).generalized()
63+ 2*hypergeometric((1, -1), (), -2)
64+ sage: hypergeometric_U(3, I, 2).generalized()
65+diff --git a/src/sage/functions/log.py b/src/sage/functions/log.py
66+index 75d1bf8060..61968582af 100644
67+--- a/src/sage/functions/log.py
68++++ b/src/sage/functions/log.py
69+@@ -518,17 +518,17 @@ class Function_polylog(GinacFunction):
70+
71+ sage: BF = RealBallField(100)
72+ sage: polylog(2, BF(1/3))
73+- [0.36621322997706348761674629766 +/- 4.51e-30]
74++ [0.36621322997706348761674629766... +/- ...]
75+ sage: polylog(2, BF(4/3))
76+- nan
77++ [2.27001825336107090380391448586 +/- 5.64e-30] + [-0.90377988538400159956755721265 +/- 8.39e-30]*I
78+ sage: parent(_)
79+- Real ball field with 100 bits of precision
80++ Complex ball field with 100 bits of precision
81+ sage: polylog(2, CBF(1/3))
82+- [0.366213229977063 +/- 5.85e-16]
83++ [0.366213229977063 +/- ...]
84+ sage: parent(_)
85+ Complex ball field with 53 bits of precision
86+ sage: polylog(2, CBF(1))
87+- [1.644934066848226 +/- 6.59e-16]
88++ [1.644934066848226 +/- ...]
89+ sage: parent(_)
90+ Complex ball field with 53 bits of precision
91+ """
92+diff --git a/src/sage/functions/trig.py b/src/sage/functions/trig.py
93+index e7e7a311cd..1f2926d6c9 100644
94+--- a/src/sage/functions/trig.py
95++++ b/src/sage/functions/trig.py
96+@@ -529,13 +529,8 @@ class Function_arcsin(GinacFunction):
97+ arcsin
98+ sage: asin(complex(1,1))
99+ (0.6662394324925152+1.0612750619050357j)
100+-
101+- Check that :trac:`22823` is fixed::
102+-
103+- sage: bool(asin(SR(2.1)) == NaN)
104+- True
105+- sage: asin(SR(2.1)).is_real()
106+- False
107++ sage: asin(SR(2.1))
108++ 1.57079632679490 - 1.37285914424258*I
109+ """
110+ GinacFunction.__init__(self, 'arcsin', latex_name=r"\arcsin",
111+ conversions=dict(maxima='asin', sympy='asin', fricas="asin", giac="asin"))
112+@@ -595,13 +590,8 @@ class Function_arccos(GinacFunction):
113+ arccos
114+ sage: acos(complex(1,1))
115+ (0.9045568943023814-1.0612750619050357j)
116+-
117+- Check that :trac:`22823` is fixed::
118+-
119+- sage: bool(acos(SR(2.1)) == NaN)
120+- True
121+- sage: acos(SR(2.1)).is_real()
122+- False
123++ sage: acos(SR(2.1))
124++ 1.37285914424258*I
125+ """
126+ GinacFunction.__init__(self, 'arccos', latex_name=r"\arccos",
127+ conversions=dict(maxima='acos', sympy='acos', fricas='acos', giac='acos'))
128+@@ -807,7 +797,7 @@ class Function_arcsec(GinacFunction):
129+ sage: arcsec(2).n(100)
130+ 1.0471975511965977461542144611
131+ sage: arcsec(1/2).n(100)
132+- NaN
133++ 1.3169578969248167086250463473*I
134+ sage: RDF(arcsec(2)) # abs tol 1e-15
135+ 1.0471975511965976
136+ sage: arcsec(1 + I)
137+@@ -958,7 +948,9 @@ class Function_arctan2(GinacFunction):
138+ sage: atan2(0,0,hold=True)
139+ arctan2(0, 0)
140+ sage: atan2(0,0,hold=True).n()
141+- NaN
142++ Traceback (most recent call last):
143++ ...
144++ RuntimeError: atan2(): division by zero
145+
146+ Check if :trac:`10062` is fixed, this was caused by
147+ ``(I*I).is_positive()`` returning ``True``::
148+diff --git a/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py b/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
149+index 3b5c8d1729..1c6b73a16c 100644
150+--- a/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
151++++ b/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
152+@@ -1422,8 +1422,10 @@ class HyperbolicGeodesicUHP(HyperbolicGeodesic):
153+ expressions do not generate runtime errors. ::
154+
155+ sage: g=HyperbolicPlane().UHP().get_geodesic(-1+I,1+I)
156+- sage: g.midpoint()
157+- Point in UHP 1/2*(sqrt(2)*e^(1/2*arccosh(3)) - sqrt(2) + (I - 1)*e^(1/2*arccosh(3)) + I - 1)/((1/4*I - 1/4)*sqrt(2)*e^(1/2*arccosh(3)) - (1/4*I - 1/4)*sqrt(2) + 1/2*e^(1/2*arccosh(3)) + 1/2)
158++ sage: point = g.midpoint(); point
159++ Point in UHP -1/2*(sqrt(2)*...
160++ sage: QQbar(point.coordinates()).radical_expression()
161++ I*sqrt(2)
162+
163+ Check that floating points remain floating points
164+ in :meth:`midpoint` ::
165+diff --git a/src/sage/interfaces/fricas.py b/src/sage/interfaces/fricas.py
166+index 82aae78e37..8501ea2a18 100644
167+--- a/src/sage/interfaces/fricas.py
168++++ b/src/sage/interfaces/fricas.py
169+@@ -1084,14 +1084,14 @@ class FriCASElement(ExpectElement):
170+ 0.451026811796262,
171+ 0.732815101786507,
172+ 0.837981225008390,
173+- NaN,
174+- NaN,
175++ 1.57079632679490 - 0.467145308103262*I,
176++ 0.467145308103262*I,
177+ 1.11976951499863,
178+ 0.451026811796262,
179+ 0.732815101786507,
180+ 0.837981225008390,
181+- NaN,
182+- NaN]
183++ 1.57079632679490 - 0.467145308103262*I,
184++ 0.467145308103262*I]
185+ sage: l = [tanh, sinh, cosh, coth, sech, csch, asinh, acosh, atanh, acoth, asech, acsch, arcsinh, arccosh, arctanh, arccoth, arcsech, arccsch]
186+ sage: [f(x)._fricas_().sage().subs(x=0.9) for f in l] # optional - fricas
187+ [0.716297870199024,
188+diff --git a/src/sage/libs/pynac/pynac.pyx b/src/sage/libs/pynac/pynac.pyx
189+index 9e9d8f664b..e3406f007e 100644
190+--- a/src/sage/libs/pynac/pynac.pyx
191++++ b/src/sage/libs/pynac/pynac.pyx
192+@@ -1824,7 +1824,7 @@ cdef py_atan2(x, y):
193+ sage: atan2(CC(I), CC(I+1))
194+ 0.553574358897045 + 0.402359478108525*I
195+ sage: atan2(CBF(I), CBF(I+1))
196+- [0.55357435889705 +/- 5.58e-15] + [0.402359478108525 +/- 7.11e-16]*I
197++ [0.55357435889705 +/- ...] + [0.402359478108525 +/- ...]*I
198+
199+ Check that :trac:`23776` is fixed and RDF input gives real output::
200+
201+diff --git a/src/sage/matrix/matrix_symbolic_dense.pyx b/src/sage/matrix/matrix_symbolic_dense.pyx
202+index 46a15e53eb..7a0beb437b 100644
203+--- a/src/sage/matrix/matrix_symbolic_dense.pyx
204++++ b/src/sage/matrix/matrix_symbolic_dense.pyx
205+@@ -200,7 +200,7 @@ cdef class Matrix_symbolic_dense(Matrix_generic_dense):
206+ sage: eval, [evec], mult = es[0]
207+ sage: delta = eval*evec - evec*A
208+ sage: abs(abs(delta)) < 1e-10
209+- sqrt(9/25*((2*sqrt(6) - 3)*(sqrt(6) - 2) + 7*sqrt(6) - 18)^2 + 9/25*((sqrt(6) - 2)*(sqrt(6) - 4) + 6*sqrt(6) - 14)^2) < (1.00000000000000e-10)
210++ 3/5*sqrt(((2*sqrt(6) - 3)*(sqrt(6) - 2) + 7*sqrt(6) - 18)^2 + ((sqrt(6) - 2)*(sqrt(6) - 4) + 6*sqrt(6) - 14)^2) < (1.00000000000000e-10)
211+ sage: abs(abs(delta)).n() < 1e-10
212+ True
213+
214+diff --git a/src/sage/modules/matrix_morphism.py b/src/sage/modules/matrix_morphism.py
215+index 17a1d6e290..03892ceec0 100644
216+--- a/src/sage/modules/matrix_morphism.py
217++++ b/src/sage/modules/matrix_morphism.py
218+@@ -214,9 +214,9 @@ class MatrixMorphism_abstract(sage.categories.morphism.Morphism):
219+ sage: f((1, 0))
220+ Traceback (most recent call last):
221+ ...
222+- TypeError: Unable to coerce entries (=[1.00000000000000*I, 0.000000000000000]) to coefficients in Real Field with 53 bits of precision
223++ TypeError: Unable to coerce entries (=[1.00000000000000*I, 0]) to coefficients in Real Field with 53 bits of precision
224+ sage: f((1, 0), coerce=False)
225+- (1.00000000000000*I, 0.000000000000000)
226++ (1.00000000000000*I, 0)
227+
228+ """
229+ if self.domain().is_ambient():
230+diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
231+index 77cdeb8c46..e501e74036 100644
232+--- a/src/sage/plot/plot.py
233++++ b/src/sage/plot/plot.py
234+@@ -2061,7 +2061,7 @@ def _plot(funcs, xrange, parametric=False,
235+ plot properly (:trac:`13246`)::
236+
237+ sage: parametric_plot((x, arcsec(x)), (x, -2, 2))
238+- Graphics object consisting of 1 graphics primitive
239++ Graphics object consisting of 2 graphics primitives
240+
241+ """
242+ from sage.plot.colors import Color
243+diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py
244+index 8ce2e839d7..948207c95e 100644
245+--- a/src/sage/repl/display/formatter.py
246++++ b/src/sage/repl/display/formatter.py
247+@@ -25,11 +25,11 @@ generally, all sage expression as an ASCII art object::
248+ sage: shell = get_test_shell()
249+ sage: shell.run_cell('%display ascii_art')
250+ sage: shell.run_cell('integral(x^2/pi^x, x)')
251+- / 2 2 \ -x*log(pi)
252+- -\x *log (pi) + 2*x*log(pi) + 2/*e
253+- ---------------------------------------------
254+- 3
255+- log (pi)
256++ -x / 2 2 \
257++ -pi *\x *log (pi) + 2*x*log(pi) + 2/
258++ --------------------------------------
259++ 3
260++ log (pi)
261+ sage: shell.run_cell("i = var('i')")
262+ sage: shell.run_cell('sum(i*x^i, i, 0, 10)')
263+ 10 9 8 7 6 5 4 3 2
264+diff --git a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
265+index d8ebbf4f76..8c60f65e99 100644
266+--- a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
267++++ b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
268+@@ -151,8 +151,8 @@ A multiple point example (Example 6.5 of [RaWi2012]_)::
269+ [(x + 2*y - 1, 1), (2*x + y - 1, 1)])
270+ sage: F1 = decomp[1]
271+ sage: F1.asymptotics(p, alpha, 2)
272+- (-3*((2*a^2 - 5*a*b + 2*b^2)*r^2 + (a + b)*r + 3)*((1/3)^(-a)*(1/3)^(-b))^r,
273+- (1/3)^(-a)*(1/3)^(-b), -3*(2*a^2 - 5*a*b + 2*b^2)*r^2 - 3*(a + b)*r - 9)
274++ (-3*((2*a^2 - 5*a*b + 2*b^2)*r^2 + (a + b)*r + 3)*(1/((1/3)^a*(1/3)^b))^r,
275++ 1/((1/3)^a*(1/3)^b), -3*(2*a^2 - 5*a*b + 2*b^2)*r^2 - 3*(a + b)*r - 9)
276+ sage: alpha = [4, 3]
277+ sage: decomp = F.asymptotic_decomposition(alpha)
278+ sage: F1 = decomp[1]
279+@@ -2159,7 +2159,7 @@ class FractionWithFactoredDenominator(RingElement):
280+ sage: p = {x: 1/3, y: 1/3}
281+ sage: alpha = (var('a'), var('b'))
282+ sage: F.asymptotics_multiple(p, alpha, 2, var('r')) # long time
283+- (3*((1/3)^(-a)*(1/3)^(-b))^r*e^(2/3), (1/3)^(-a)*(1/3)^(-b), 3*e^(2/3))
284++ (3*(1/((1/3)^a*(1/3)^b))^r*e^(2/3), 1/((1/3)^a*(1/3)^b), 3*e^(2/3))
285+ """
286+ from itertools import product
287+ from sage.calculus.functions import jacobian
288+diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py
289+index 16a268a02c..5fd244e93b 100644
290+--- a/src/sage/stats/basic_stats.py
291++++ b/src/sage/stats/basic_stats.py
292+@@ -183,7 +183,7 @@ def std(v, bias=False):
293+ sage: std([])
294+ NaN
295+ sage: std([I, sqrt(2), 3/5])
296+- sqrt(1/450*(10*sqrt(2) - 5*I - 3)^2 + 1/450*(5*sqrt(2) - 10*I + 3)^2 + 1/450*(5*sqrt(2) + 5*I - 6)^2)
297++ 1/15*sqrt(1/2)*sqrt((10*sqrt(2) - 5*I - 3)^2 + (5*sqrt(2) - 10*I + 3)^2 + (5*sqrt(2) + 5*I - 6)^2)
298+ sage: std([RIF(1.0103, 1.0103), RIF(2)])
299+ 0.6998235813403261?
300+ sage: import numpy
301+diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
302+index ab4c05de3a..60f0dc549a 100644
303+--- a/src/sage/symbolic/expression.pyx
304++++ b/src/sage/symbolic/expression.pyx
305+@@ -622,7 +622,7 @@ cdef class Expression(CommutativeRingElement):
306+ sage: x^(-5)
307+ x^(-5)
308+ sage: x^(-y)
309+- x^(-y)
310++ 1/(x^y)
311+ sage: 2*x^(-1)
312+ 2/x
313+ sage: i*x
314+@@ -3621,14 +3621,14 @@ cdef class Expression(CommutativeRingElement):
315+ sage: repl_dict = {b_0: b_0, b_3: b_1, b_2: b_3, b_1: b_2}
316+ sage: P = precomp.substitute(repl_dict)
317+ sage: P.expand()
318+- -2^(-b_0)*2^(-b_2)*2^b_3 - 2^b_0*2^(-b_2)*2^b_3 -
319+- 2^(-b_0)*2^b_2*2^b_3 + 2^b_0*2^b_2*2^b_3 - 2*2^(-b_0)*2^(-b_2)
320+- - 2*2^b_0*2^(-b_2) - 2*2^(-b_0)*2^b_2 + 2*2^b_0*2^b_2 +
321+- 2^(-b_0)*2^b_3 + 2^b_0*2^b_3 + 2^(-b_2)*2^b_3 + 2^b_2*2^b_3 +
322+- 2*2^(-b_0) + 2*2^b_0 + 2*2^(-b_2) + 2*2^b_2 - 9*2^b_3 -
323+- 2^(-b_0)*2^(-b_2)/2^b_3 - 2^b_0*2^(-b_2)/2^b_3 -
324+- 2^(-b_0)*2^b_2/2^b_3 + 2^b_0*2^b_2/2^b_3 + 2^(-b_0)/2^b_3 +
325+- 2^b_0/2^b_3 + 2^(-b_2)/2^b_3 + 2^b_2/2^b_3 - 9/2^b_3 - 18
326++ 2^b_0*2^b_2*2^b_3 + 2*2^b_0*2^b_2 + 2^b_0*2^b_3 + 2^b_2*2^b_3 +
327++ 2*2^b_0 + 2*2^b_2 - 9*2^b_3 + 2^b_0*2^b_2/2^b_3 -
328++ 2^b_0*2^b_3/2^b_2 - 2^b_2*2^b_3/2^b_0 - 2*2^b_0/2^b_2 -
329++ 2*2^b_2/2^b_0 + 2^b_0/2^b_3 + 2^b_2/2^b_3 + 2^b_3/2^b_0 +
330++ 2^b_3/2^b_2 + 2/2^b_0 + 2/2^b_2 - 2^b_0/(2^b_2*2^b_3) -
331++ 2^b_2/(2^b_0*2^b_3) - 9/2^b_3 - 2^b_3/(2^b_0*2^b_2) -
332++ 2/(2^b_0*2^b_2) + 1/(2^b_0*2^b_3) + 1/(2^b_2*2^b_3) -
333++ 1/(2^b_0*2^b_2*2^b_3) - 18
334+
335+ sage: _0,b_1,b_2=var('b_0,b_1,b_2')
336+ sage: f = 1/27*b_2^2/(2^b_2)^2 + 1/27*b_1^2/(2^b_1)^2 + \
337+@@ -3809,7 +3809,7 @@ cdef class Expression(CommutativeRingElement):
338+
339+ sage: x = SR.symbol('x', domain='real')
340+ sage: (x^3)^(1/3)
341+- (x^3)^(1/3)
342++ x
343+ sage: (x^4)^(1/4)
344+ abs(x)
345+ sage: (x^8)^(1/4)
346+@@ -3872,7 +3872,7 @@ cdef class Expression(CommutativeRingElement):
347+ sage: 2^(x/log(2))
348+ e^x
349+ sage: 2^(-x^2/2/log(2))
350+- e^(-1/2*x^2)
351++ 1/e^(1/2*x^2)
352+ sage: x^(x/log(x))
353+ x^(x/log(x))
354+ sage: assume(x > 0)
355+@@ -4816,18 +4816,24 @@ cdef class Expression(CommutativeRingElement):
356+ sage: ((x+y)^(x+y)).match(w0^w0)
357+ {$0: x + y}
358+ sage: t = ((a+b)*(a+c)).match((a+w0)*(a+w1))
359+- sage: t[w0], t[w1]
360+- (c, b)
361++ sage: set([t[w0], t[w1]]) == set([b, c])
362++ True
363+ sage: ((a+b)*(a+c)).match((w0+b)*(w0+c))
364+ {$0: a}
365+ sage: t = ((a+b)*(a+c)).match((w0+w1)*(w0+w2))
366+- sage: t[w0], t[w1], t[w2]
367+- (a, c, b)
368+- sage: print(((a+b)*(a+c)).match((w0+w1)*(w1+w2)))
369+- None
370++ sage: t[w0]
371++ a
372++ sage: set([t[w1], t[w2]]) == set([b, c])
373++ True
374++ sage: t = ((a+b)*(a+c)).match((w0+w1)*(w1+w2))
375++ sage: t[w1]
376++ a
377++ sage: set([t[w0], t[w2]]) == set([b, c])
378++ True
379+ sage: t = (a*(x+y)+a*z+b).match(a*w0+w1)
380+- sage: t[w0], t[w1]
381+- (x + y, a*z + b)
382++ sage: s = set([t[w0], t[w1]])
383++ sage: s == set([x+y, a*z+b]) or s == set([z, a*(x+y)+b])
384++ True
385+ sage: print((a+b+c+d+f+g).match(c))
386+ None
387+ sage: (a+b+c+d+f+g).has(c)
388+@@ -4836,7 +4842,7 @@ cdef class Expression(CommutativeRingElement):
389+ {$0: a + b + d + f + g}
390+ sage: (a+b+c+d+f+g).match(c+g+w0)
391+ {$0: a + b + d + f}
392+- sage: (a+b).match(a+b+w0)
393++ sage: (a+b).match(a+b+w0) # known bug
394+ {$0: 0}
395+ sage: print((a*b^2).match(a^w0*b^w1))
396+ None
397+@@ -5009,7 +5015,7 @@ cdef class Expression(CommutativeRingElement):
398+ a^3 + b^3 + (x + y)^3
399+
400+ sage: t.subs(w0 == w0^2)
401+- (x^2 + y^2)^18 + a^16 + b^16
402++ a^8 + b^8 + (x^2 + y^2)^6
403+
404+ sage: t.subs(a == b, b == c)
405+ (x + y)^3 + b^2 + c^2
406+@@ -8392,9 +8398,13 @@ cdef class Expression(CommutativeRingElement):
407+ sage: SR(I).arctan2(1)
408+ arctan2(I, 1)
409+ sage: SR(CDF(0,1)).arctan2(1)
410+- NaN + +infinity*I
411+- sage: SR(1).arctan2(CDF(0,1)) # known bug
412+- 0.7853981633974484 - 19.012501686914433*I
413++ Traceback (most recent call last):
414++ ...
415++ ValueError: power::eval(): division by zero
416++ sage: SR(1).arctan2(CDF(0,1))
417++ Traceback (most recent call last):
418++ ...
419++ ValueError: power::eval(): division by zero
420+
421+ sage: arctan2(0,oo)
422+ 0
423+@@ -8656,7 +8666,7 @@ cdef class Expression(CommutativeRingElement):
424+ 1/2*I*pi
425+ sage: SR(1/2).arccosh()
426+ arccosh(1/2)
427+- sage: SR(CDF(1/2)).arccosh() # rel tol 1e-15
428++ sage: SR(CDF(1/2)).arccosh() # rel tol 1e-15
429+ 1.0471975511965976*I
430+ sage: maxima('acosh(0.5)')
431+ 1.04719755119659...*%i
432+@@ -11687,7 +11697,7 @@ cdef class Expression(CommutativeRingElement):
433+ sage: a.solve(t)
434+ []
435+ sage: b = a.canonicalize_radical(); b
436+- -23040.0*(-2.0*e^(1800*t) + 25.0*e^(900*t) - 32.0)*e^(-2400*t)
437++ (46080.0*e^(1800*t) - 576000.0*e^(900*t) + 737280.0)*e^(-2400*t)
438+ sage: b.solve(t)
439+ []
440+ sage: b.solve(t, to_poly_solve=True)
441+@@ -12163,14 +12173,14 @@ cdef class Expression(CommutativeRingElement):
442+
443+ sage: (n,k,j)=var('n,k,j')
444+ sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
445+- -(-1)^(-j)*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
446++ -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
447+ sage: assume(j>-1)
448+ sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
449+ 1
450+ sage: forget()
451+ sage: assume(n>=j)
452+ sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
453+- -(-1)^(-j)*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
454++ -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
455+ sage: forget()
456+ sage: assume(j==-1)
457+ sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
458+@@ -12178,7 +12188,7 @@ cdef class Expression(CommutativeRingElement):
459+ sage: forget()
460+ sage: assume(j<-1)
461+ sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
462+- -(-1)^(-j)*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
463++ -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
464+ sage: forget()
465+
466+ Check that :trac:`16176` is fixed::
467+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
468+index da6f0eef42..4bd65ef572 100644
469+--- a/src/sage/symbolic/relation.py
470++++ b/src/sage/symbolic/relation.py
471+@@ -895,7 +895,7 @@ def solve(f, *args, **kwds):
472+ sage: (r[0][x], r[0][y])
473+ (2*lambert_w(1/2), 1)
474+ sage: solve(-2*x**3 + 4*x**2 - 2*x + 6 > 0, x, algorithm='sympy')
475+- [x < (1/6*sqrt(77) + 79/54)^(1/3) + 1/9/(1/6*sqrt(77) + 79/54)^(1/3) + 2/3]
476++ [x < 1/3*(1/2)^(1/3)*(9*sqrt(77) + 79)^(1/3) + 2/3*(1/2)^(2/3)/(9*sqrt(77) + 79)^(1/3) + 2/3]
477+ sage: solve(sqrt(2*x^2 - 7) - (3 - x),x,algorithm='sympy')
478+ [x == -8, x == 2]
479+ sage: solve(sqrt(2*x + 9) - sqrt(x + 1) - sqrt(x + 4),x,algorithm='sympy')
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/test-in-tmpdir.patchnew file+31
@@ -0,0 +1,31 @@
1+diff --git a/src/sage/repl/ipython_kernel/install.py b/src/sage/repl/ipython_kernel/install.py
2+index aa23c8405d..8a87de0591 100644
3+--- a/src/sage/repl/ipython_kernel/install.py
4++++ b/src/sage/repl/ipython_kernel/install.py
5+@@ -112,7 +112,7 @@ class SageKernelSpec(object):
6+ EXAMPLES::
7+
8+ sage: from sage.repl.ipython_kernel.install import SageKernelSpec
9+- sage: spec = SageKernelSpec()
10++ sage: spec = SageKernelSpec(prefix = tmp_dir())
11+ sage: spec.use_local_mathjax()
12+ sage: mathjax = os.path.join(spec.nbextensions_dir, 'mathjax')
13+ sage: os.path.isdir(mathjax)
14+@@ -129,7 +129,7 @@ class SageKernelSpec(object):
15+ EXAMPLES::
16+
17+ sage: from sage.repl.ipython_kernel.install import SageKernelSpec
18+- sage: spec = SageKernelSpec()
19++ sage: spec = SageKernelSpec(prefix = tmp_dir())
20+ sage: spec.use_local_jsmol()
21+ sage: jsmol = os.path.join(spec.nbextensions_dir, 'jsmol')
22+ sage: os.path.isdir(jsmol)
23+@@ -146,7 +146,7 @@ class SageKernelSpec(object):
24+ EXAMPLES::
25+
26+ sage: from sage.repl.ipython_kernel.install import SageKernelSpec
27+- sage: spec = SageKernelSpec()
28++ sage: spec = SageKernelSpec(prefix = tmp_dir())
29+ sage: spec.use_local_threejs()
30+ sage: threejs = os.path.join(spec.nbextensions_dir, 'threejs')
31+ sage: os.path.isdir(threejs)
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+205
@@ -0,0 +1,205 @@
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+ # https://trac.sagemath.org/ticket/25546
31+ # https://trac.sagemath.org/ticket/25722
32+ (fetchpatch {
33+ name = "install-jupyter-kernel-in-correct-prefix.patch";
34+ url = "https://git.sagemath.org/sage.git/patch?id=72167b98e3f64326df6b2c78785df25539472fcc";
35+ sha256 = "0pscnjhm7r2yr2rxnv4kkkq626vwaja720lixa3m3w9rwlxll5a7";
36+ })
37+ ./patches/test-in-tmpdir.patch
38+
39+ # https://trac.sagemath.org/ticket/25358
40+ (fetchpatch {
41+ name = "safe-directory-test-without-patch.patch";
42+ url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=dc673c17555efca611f68398d5013b66e9825463";
43+ sha256 = "1hhannz7xzprijakn2w2d0rhd5zv2zikik9p51i87bas3nc658f7";
44+ })
45+
46+ # https://trac.sagemath.org/ticket/25357 rebased on 8.2
47+ ./patches/python3-syntax-without-write.patch
48+
49+ # https://trac.sagemath.org/ticket/25314
50+ (fetchpatch {
51+ name = "make-qepcad-test-optional.patch";
52+ url = "https://git.sagemath.org/sage.git/patch/?h=fe294c58bd035ef427e268901d54a6faa0058138";
53+ sha256 = "003d5baf5c0n5rfg010ijwkwz8kg0s414cxwczs2vhdayxdixbix";
54+ })
55+
56+ # https://trac.sagemath.org/ticket/25316
57+ ./patches/python-5755-hotpatch.patch
58+
59+ # https://trac.sagemath.org/ticket/25354
60+ # https://trac.sagemath.org/ticket/25531
61+ (fetchpatch {
62+ name = "cysignals-include.patch";
63+ url = "https://git.sagemath.org/sage.git/patch/?h=28778bd25a37c80884d2b24e0683fb2989300cef";
64+ sha256 = "0fiiiw91pgs8avm9ggj8hb64bhqzl6jcw094d94nhirmh8w2jmc5";
65+ })
66+
67+ # https://trac.sagemath.org/ticket/25315
68+ (fetchpatch {
69+ name = "find-libraries-in-dyld-library-path.patch";
70+ url = "https://git.sagemath.org/sage.git/patch/?h=20d4593876ce9c6004eac2ab6fd61786d0d96a06";
71+ sha256 = "1k3afq3qlzmgqwx6rzs5wv153vv9dsf5rk8pi61g57l3r3npbjmc";
72+ })
73+
74+ # Pari upstream has since accepted a patch, so this patch won't be necessary once sage updates pari.
75+ # https://trac.sagemath.org/ticket/25312
76+ ./patches/pari-stackwarn.patch
77+
78+ # https://trac.sagemath.org/ticket/25311
79+ ./patches/zn_poly_version.patch
80+
81+ # https://trac.sagemath.org/ticket/25345
82+ # (upstream patch doesn't apply on 8.2 source)
83+ ./patches/dochtml-optional.patch
84+ ];
85+
86+ packageUpgradePatches = [
87+ # matplotlib 2.2.2 deprecated `normed` (replaced by `density`).
88+ # This patch only ignores the warning. It would be equally easy to fix it
89+ # (by replacing all mentions of `normed` by `density`), but its better to
90+ # stay close to sage upstream. I didn't open an upstream ticket about it
91+ # because the matplotlib update also requires a new dependency (kiwisolver)
92+ # and I don't want to invest the time to learn how to add it.
93+ ./patches/matplotlib-normed-deprecated.patch
94+
95+ # Update to 20171219 broke the doctests because of insignificant precision
96+ # changes, make the doctests less fragile.
97+ # I didn't open an upstream ticket because its not entirely clear if
98+ # 20171219 is really "released" yet. It is listed on the github releases
99+ # page, but not marked as "latest release" and the homepage still links to
100+ # the last version.
101+ ./patches/eclib-regulator-precision.patch
102+
103+ # sphinx 1.6 -> 1.7 upgrade
104+ # https://trac.sagemath.org/ticket/24935
105+ ./patches/sphinx-1.7.patch
106+
107+ # https://trac.sagemath.org/ticket/25320
108+ (fetchpatch {
109+ name = "zero_division_error_formatting.patch";
110+ url = "https://git.sagemath.org/sage.git/patch/?h=f79070ddd09fa0ad6b340b097bd8d690a7aa35f0";
111+ sha256 = "02wsc3wbp8g8dk5jcjyv18d9v537h3zp5v8lwir46j4na4kj0dlb";
112+ })
113+
114+ # Adapt hashes to new boost version
115+ # https://trac.sagemath.org/ticket/22243
116+ # (this ticket doesn't only upgrade boost but also avoids this problem in the future)
117+ (fetchpatch {
118+ name = "boost-upgrade.patch";
119+ url = "https://git.sagemath.org/sage.git/patch?id=a24a9c6b30b93957333a3116196214a931325b69";
120+ sha256 = "0z3870g2ms2a81vnw08dc2i4k7jr62w8fggvcdwaavgd1wvdxwfl";
121+ })
122+
123+ # gfan 0.6.2
124+ # https://trac.sagemath.org/ticket/23353
125+ (fetchpatch {
126+ name = "gfan-update.patch";
127+ url = "https://git.sagemath.org/sage.git/patch/?h=420215fc469cde733ec7a339e59b78ad6eec804c&id=112498a293ea2bf563e41aed35f1aa608f01b349";
128+ sha256 = "0ga3hkx8cr23dpc919lgvpi5lmy0d728jkq9z6kf0fl9s8g31mxb";
129+ })
130+
131+ # New glpk version has new warnings, filter those out until upstream sage has found a solution
132+ # https://trac.sagemath.org/ticket/24824
133+ (fetchpatch {
134+ url = "https://salsa.debian.org/science-team/sagemath/raw/58bbba93a807ca2933ca317501d093a1bb4b84db/debian/patches/dt-version-glpk-4.65-ignore-warnings.patch";
135+ sha256 = "0b9293v73wb4x13wv5zwyjgclc01zn16msccfzzi6znswklgvddp";
136+ stripLen = 1;
137+ })
138+
139+ # https://trac.sagemath.org/ticket/25329
140+ (fetchpatch {
141+ name = "dont-check-exact-glpk-version.patch";
142+ url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=89d068d8d77316bfffa6bf8e9ebf70b3b3b88e5c";
143+ sha256 = "00knwxs6fmymfgfl0q5kcavmxm9sf90a4r76y35n5s55gj8pl918";
144+ })
145+
146+ # https://trac.sagemath.org/ticket/25355
147+ (fetchpatch {
148+ name = "maxima-5.41.0.patch";
149+ url = "https://git.sagemath.org/sage.git/patch/?id=87328023c4739abdf24108038201e3fa9bdfc739";
150+ sha256 = "0hxi7qr5mfx1bc32r8j7iba4gzd7c6v63asylyf5cbyp86azpb7i";
151+ })
152+
153+ # Update cddlib from 0.94g to 0.94h.
154+ # https://trac.sagemath.org/ticket/25341 (doesn't apply to 8.2 sources)
155+ (fetchpatch {
156+ url = "https://salsa.debian.org/science-team/sagemath/raw/58bbba93a807ca2933ca317501d093a1bb4b84db/debian/patches/u2-version-cddlib-094h.patch";
157+ sha256 = "0fmw7pzbaxs2dshky6iw9pr8i23p9ih2y2lw661qypdrxh5xw03k";
158+ stripLen = 1;
159+ })
160+ ./patches/revert-269c1e1551285.patch
161+
162+
163+ # Only formatting changes.
164+ # https://trac.sagemath.org/ticket/25260
165+ ./patches/numpy-1.14.3.patch
166+
167+ # https://trac.sagemath.org/ticket/24374
168+ (fetchpatch {
169+ name = "networkx-2.1.patch";
170+ url = "https://salsa.debian.org/science-team/sagemath/raw/487df9ae48ca1d93d9b1cb3af8745d31e30fb741/debian/patches/u0-version-networkx-2.1.patch";
171+ sha256 = "1xxxawygbgxgvlv7b4w8hhzgdnva4rhmgdxaiaa3pwdwln0yc750";
172+ stripLen = 1;
173+ })
174+
175+ # https://trac.sagemath.org/ticket/24927 rebased
176+ ./patches/arb-2.13.0.patch
177+
178+ # https://trac.sagemath.org/ticket/24838 rebased
179+ ./patches/pynac-0.7.22.patch
180+ ];
181+
182+ patches = nixPatches ++ packageUpgradePatches;
183+
184+ postPatch = ''
185+ # make sure shebangs etc are fixed, but sage-python23 still works
186+ find . -type f -exec sed \
187+ -e 's/sage-python23/python/g' \
188+ -i {} \;
189+
190+ echo '#!${stdenv.shell}
191+ python "$@"' > build/bin/sage-python23
192+
193+ # Do not use sage-env-config (generated by ./configure).
194+ # Instead variables are set manually.
195+ echo '# do nothing' > src/bin/sage-env-config
196+ '';
197+
198+ configurePhase = "# do nothing";
199+
200+ buildPhase = "# do nothing";
201+
202+ installPhase = ''
203+ cp -r . "$out"
204+ '';
205+}
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/applications/science/math/symmetrica/default.nix+20−3
@@ -1,14 +1,15 @@
1−{stdenv, fetchurl}:
1+{ stdenv
2+, fetchurl
3+, fetchpatch
4+}:
25stdenv.mkDerivation rec {
36 name = "symmetrica-${version}";
47 version = "2.0";
5− # or fetchFromGitHub(owner,repo,rev) or fetchgit(rev)
68 src = fetchurl {
79 url = "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/SYM2_0_tar.gz";
810 sha256 = "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz";
911 name = "symmetrica-2.0.tar.gz";
1012 };
11− buildInputs = [];
1213 sourceRoot = ".";
1314 installPhase = ''
1415 mkdir -p "$out"/{lib,share/doc/symmetrica,include/symmetrica}
@@ -18,6 +19,22 @@ stdenv.mkDerivation rec {
1819 cp *.h "$out/include/symmetrica"
1920 cp README *.doc "$out/share/doc/symmetrica"
2021 '';
22+ patches = [
23+ # don't show banner ("SYMMETRICA VERSION X - STARTING)
24+ # it doesn't contain very much helpful information and a banner is not ideal for a library
25+ (fetchpatch {
26+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/de.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
27+ sha256 = "0df0vqixcfpzny6dkhyj87h8aznz3xn3zfwwlj8pd10bpb90k6gb";
28+ })
29+
30+ # use int32_t and uint32_t for type INT
31+ # see https://trac.sagemath.org/ticket/13413
32+ (fetchpatch {
33+ name = "fix_64bit_integer_overflow.patch";
34+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/int32.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
35+ sha256 = "0p33c85ck4kd453z687ni4bdcqr1pqx2756j7aq11bf63vjz4cyz";
36+ })
37+ ];
2138 meta = {
2239 inherit version;
2340 description = ''A collection of routines for representation theory and combinatorics'';
pkgs/build-support/fetchurl/mirrors.nix+31−34
@@ -319,51 +319,48 @@ rec {
319319 ];
320320
321321 # Sage mirrors (http://www.sagemath.org/mirrors.html)
322− sagemath = [
322+ sageupstream = [
323323 # Africa
324− http://sagemath.polytechnic.edu.na/src/
325− ftp://ftp.sun.ac.za/pub/mirrors/www.sagemath.org/src/
326− http://sagemath.mirror.ac.za/src/
327− https://ftp.leg.uct.ac.za/pub/packages/sage/src/
328− http://mirror.ufs.ac.za/sagemath/src/
324+ http://sagemath.polytechnic.edu.na/spkg/upstream/
325+ ftp://ftp.sun.ac.za/pub/mirrors/www.sagemath.org/spkg/upstream/
326+ http://sagemath.mirror.ac.za/spkg/upstream/
327+ https://ftp.leg.uct.ac.za/pub/packages/sage/spkg/upstream/
328+ http://mirror.ufs.ac.za/sagemath/spkg/upstream/
329329
330330 # America, North
331− http://mirrors-usa.go-parts.com/sage/sagemath/src/
332− http://mirrors.mit.edu/sage/src/
333− http://www.cecm.sfu.ca/sage/src/
334− http://files.sagemath.org/src/
335− http://mirror.clibre.uqam.ca/sage/src/
336− https://mirrors.xmission.com/sage/src/
331+ http://mirrors-usa.go-parts.com/sage/sagemath/spkg/upstream/
332+ http://mirrors.mit.edu/sage/spkg/upstream/
333+ http://www.cecm.sfu.ca/sage/spkg/upstream/
334+ http://files.sagemath.org/spkg/upstream/
335+ http://mirror.clibre.uqam.ca/sage/spkg/upstream/
336+ https://mirrors.xmission.com/sage/spkg/upstream/
337337
338338 # America, South
339− http://sagemath.c3sl.ufpr.br/src/
340− http://linorg.usp.br/sage/
339+ http://sagemath.c3sl.ufpr.br/spkg/upstream/
340+ http://linorg.usp.br/sage/spkg/upstream
341341
342342 # Asia
343− http://sage.asis.io/src/
344− http://mirror.hust.edu.cn/sagemath/src/
345− https://ftp.iitm.ac.in/sage/src/
346− http://ftp.kaist.ac.kr/sage/src/
347− http://ftp.riken.jp/sagemath/src/
348− https://mirrors.tuna.tsinghua.edu.cn/sagemath/src/
349− https://mirrors.ustc.edu.cn/sagemath/src/
350− http://ftp.tsukuba.wide.ad.jp/software/sage/src/
351− http://ftp.yz.yamagata-u.ac.jp/pub/math/sage/src/
352− https://mirror.yandex.ru/mirrors/sage.math.washington.edu/src/
343+ http://sage.asis.io/spkg/upstream/
344+ http://mirror.hust.edu.cn/sagemath/spkg/upstream/
345+ https://ftp.iitm.ac.in/sage/spkg/upstream/
346+ http://ftp.kaist.ac.kr/sage/spkg/upstream/
347+ http://ftp.riken.jp/sagemath/spkg/upstream/
348+ https://mirrors.tuna.tsinghua.edu.cn/sagemath/spkg/upstream/
349+ https://mirrors.ustc.edu.cn/sagemath/spkg/upstream/
350+ http://ftp.tsukuba.wide.ad.jp/software/sage/spkg/upstream/
351+ http://ftp.yz.yamagata-u.ac.jp/pub/math/sage/spkg/upstream/
352+ https://mirror.yandex.ru/mirrors/sage.math.washington.edu/spkg/upstream/
353353
354354 # Australia
355− http://echidna.maths.usyd.edu.au/sage/src/
355+ http://echidna.maths.usyd.edu.au/sage/spkg/upstream/
356356
357357 # Europe
358− http://sage.mirror.garr.it/mirrors/sage/src/
359− http://sunsite.rediris.es/mirror/sagemath/src/
360− http://mirror.switch.ch/mirror/sagemath/src/
361− http://mirrors.fe.up.pt/pub/sage/src/
362− http://www-ftp.lip6.fr/pub/math/sagemath/src/
363− http://ftp.ntua.gr/pub/sagemath/src/
364−
365− # Old versions
366− http://sagemath.org/src-old/
358+ http://sage.mirror.garr.it/mirrors/sage/spkg/upstream/
359+ http://sunsite.rediris.es/mirror/sagemath/spkg/upstream/
360+ http://mirror.switch.ch/mirror/sagemath/spkg/upstream/
361+ http://mirrors.fe.up.pt/pub/sage/spkg/upstream/
362+ http://www-ftp.lip6.fr/pub/math/sagemath/spkg/upstream/
363+ http://ftp.ntua.gr/pub/sagemath/spkg/upstream/
367364 ];
368365
369366 # MySQL mirrors
pkgs/data/misc/combinatorial_designs/default.nixnew file+31
@@ -0,0 +1,31 @@
1+{ stdenv
2+, fetchurl
3+}:
4+
5+stdenv.mkDerivation rec {
6+ name = "combinatorial_designs-${version}";
7+ version = "20140630";
8+
9+ src = fetchurl {
10+ url = "mirror://sageupstream/combinatorial_designs/combinatorial_designs-${version}.tar.bz2";
11+ sha256 = "0bj8ngiq59hipa6izi6g5ph5akmy4cbk0vlsb0wa67f7grnnqj69";
12+ };
13+
14+ installPhase = ''
15+ mkdir -p "$out/share/combinatorial_designs"
16+ mv * "$out/share/combinatorial_designs"
17+ '';
18+
19+ meta = with stdenv.lib; {
20+ description = "Data for Combinatorial Designs";
21+ longDescription = ''
22+ Current content:
23+
24+ - The table of MOLS (10 000 integers) from the Handbook of Combinatorial
25+ Designs, 2ed.
26+ '';
27+ license = licenses.publicDomain;
28+ platforms = platforms.all;
29+ maintainers = with maintainers; [ timokau ];
30+ };
31+}
pkgs/data/misc/conway_polynomials/default.nixnew file+43
@@ -0,0 +1,43 @@
1+{ stdenv
2+, fetchurl
3+, python
4+}:
5+
6+stdenv.mkDerivation rec {
7+ name = "conway_polynomials-${version}";
8+ version = "0.5";
9+
10+ pythonEnv = python.withPackages (ps: with ps; [ six ]);
11+
12+ src = fetchurl {
13+ url = "mirror://sageupstream/conway_polynomials/conway_polynomials-${version}.tar.bz2";
14+ sha256 = "05zb1ly9x2bbscqv0jgc45g48xx77mfs7qdbqhn4ihmihn57iwnq";
15+ };
16+
17+ # Script that creates the "database" (nested python array) and pickles it
18+ spkg-install = fetchurl {
19+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/conway_polynomials/spkg-install.py?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
20+ sha256 = "0m12nfb37j3bn4bp06ddgnyp2d6z0hg5f83pbbjszxw7vxs33a82";
21+ };
22+
23+ installPhase = ''
24+ # directory layout as spkg-install.py expects
25+ dir="$PWD"
26+ cd ..
27+ ln -s "$dir" "src"
28+
29+ # environment spkg-install.py expects
30+ mkdir -p "$out/share"
31+ export SAGE_SHARE="$out/share"
32+ export PYTHONPATH=$PWD
33+
34+ ${pythonEnv.interpreter} ${spkg-install}
35+ '';
36+
37+ meta = with stdenv.lib; {
38+ description = "Contains a small database of Conway polynomials.";
39+ license = licenses.gpl2;
40+ platforms = platforms.all;
41+ maintainers = with maintainers; [ timokau ];
42+ };
43+}
pkgs/data/misc/elliptic_curves/default.nixnew file+51
@@ -0,0 +1,51 @@
1+{ stdenv
2+, fetchurl
3+, python
4+}:
5+
6+stdenv.mkDerivation rec {
7+ pname = "elliptic_curves";
8+ version = "0.8";
9+ name = "${pname}-${version}";
10+
11+ src = fetchurl {
12+ url = "mirror://sageupstream/${pname}/${pname}-${version}.tar.bz2";
13+ sha256 = "0pzaym44x88dn8rydiwqgm73yghzlgf7gqvd7qqsrsdl2vyp091w";
14+ };
15+
16+
17+ # Script that creates the sqlite database from the allcurves textfile
18+ spkg-install = fetchurl {
19+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/${pname}/spkg-install.py?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
20+ sha256 = "116g684i6mvs11fvb6fzfsr4fn903axn31vigdyb8bgpf8l4hvc5";
21+ };
22+
23+ installPhase = ''
24+ # directory layout as spkg-install.py expects
25+ dir="$PWD"
26+ cd ..
27+ ln -s "$dir" "src"
28+
29+ # environment spkg-install.py expects
30+ mkdir -p "$out/share"
31+ export SAGE_SHARE="$out/share"
32+ export PYTHONPATH=$PWD
33+
34+ ${python.interpreter} ${spkg-install}
35+ '';
36+
37+ meta = with stdenv.lib; {
38+ description = "Databases of elliptic curves";
39+ longDescription = ''
40+ Includes two databases:
41+
42+ * A small subset of the data in John Cremona's database of elliptic curves up
43+ to conductor 10000. See http://www.warwick.ac.uk/~masgaj/ftp/data/ or
44+ http://sage.math.washington.edu/cremona/INDEX.html
45+ * William Stein's database of interesting curves
46+ '';
47+ license = licenses.gpl2;
48+ platforms = platforms.all;
49+ maintainers = with maintainers; [ timokau ];
50+ };
51+}
pkgs/data/misc/graphs/default.nixnew file+26
@@ -0,0 +1,26 @@
1+{ stdenv
2+, fetchurl
3+}:
4+
5+stdenv.mkDerivation rec {
6+ pname = "graphs";
7+ version = "20161026";
8+ name = "${pname}-${version}";
9+
10+ src = fetchurl {
11+ url = "mirror://sageupstream/${pname}/${pname}-${version}.tar.bz2";
12+ sha256 = "0a2b5lly9nifphvknz88rrhfbbc8vqnlqcv19zdpfq8h8nnyjbb2";
13+ };
14+
15+ installPhase = ''
16+ mkdir -p "$out/share/graphs"
17+ cp * "$out/share/graphs/"
18+ '';
19+
20+ meta = with stdenv.lib; {
21+ description = "A database of graphs";
22+ license = licenses.gpl2;
23+ platforms = platforms.all;
24+ maintainers = with maintainers; [ timokau ];
25+ };
26+}
pkgs/data/misc/pari-galdata/default.nixnew file+26
@@ -0,0 +1,26 @@
1+{ stdenv
2+, fetchurl
3+}:
4+
5+stdenv.mkDerivation rec {
6+ version = "20080411";
7+ name = "pari-galdata-${version}";
8+
9+ src = fetchurl {
10+ url = "http://pari.math.u-bordeaux.fr/pub/pari/packages/galdata.tgz";
11+ sha256 = "1pch6bk76f1i6cwwgm7hhxi5h71m52lqayp4mnyj0jmjk406bhdp";
12+ };
13+
14+ installPhase = ''
15+ mkdir -p "$out/share/pari"
16+ cp -R * "$out/share/pari/"
17+ '';
18+
19+ meta = with stdenv.lib; {
20+ description = "PARI database needed to compute Galois group in degrees 8 through 11";
21+ homepage = http://pari.math.u-bordeaux.fr/;
22+ license = licenses.gpl2Plus;
23+ platforms = platforms.all;
24+ maintainers = with maintainers; [ timokau ];
25+ };
26+}
pkgs/data/misc/pari-seadata-small/default.nixnew file+26
@@ -0,0 +1,26 @@
1+{ stdenv
2+, fetchurl
3+}:
4+
5+stdenv.mkDerivation rec {
6+ version = "20090618";
7+ name = "pari-seadata-small-${version}";
8+
9+ src = fetchurl {
10+ url = "http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata-small.tgz";
11+ sha256 = "13qafribxwkz8h3haa0cng7arz0kh7398br4y7vqs9ib8w9yjnxz";
12+ };
13+
14+ installPhase = ''
15+ mkdir -p "$out/share/pari"
16+ cp -R * "$out/share/pari/"
17+ '';
18+
19+ meta = with stdenv.lib; {
20+ description = "PARI database needed by ellap for large primes";
21+ homepage = http://pari.math.u-bordeaux.fr/;
22+ license = licenses.gpl2Plus;
23+ platforms = platforms.all;
24+ maintainers = with maintainers; [ timokau ];
25+ };
26+}
pkgs/data/misc/polytopes_db/default.nixnew file+26
@@ -0,0 +1,26 @@
1+{ stdenv
2+, fetchurl
3+}:
4+
5+stdenv.mkDerivation rec {
6+ pname = "polytopes_db";
7+ version = "20170220";
8+ name = "${pname}-${version}";
9+
10+ src = fetchurl {
11+ url = "mirror://sageupstream/${pname}/${pname}-${version}.tar.bz2";
12+ sha256 = "1q0cd811ilhax4dsj9y5p7z8prlalqr7k9mzq178c03frbgqny6b";
13+ };
14+
15+ installPhase = ''
16+ mkdir -p "$out/share/reflexive_polytopes"
17+ cp -R * "$out/share/reflexive_polytopes/"
18+ '';
19+
20+ meta = with stdenv.lib; {
21+ description = "Reflexive polytopes database";
22+ license = licenses.gpl2;
23+ platforms = platforms.all;
24+ maintainers = with maintainers; [ timokau ];
25+ };
26+}
pkgs/development/compilers/ecl/16.1.2.nix+8
@@ -53,6 +53,14 @@ stdenv.mkDerivation {
5353 url = "https://gitlab.com/embeddable-common-lisp/ecl/commit/caba1989f40ef917e7486f41b9cd5c7e3c5c2d79.patch";
5454 sha256 = "07vw91psbc9gdn8grql46ra8lq3bgkzg5v480chnbryna4sv6lbb";
5555 })
56+ (fetchpatch {
57+ # Fix getcwd with long pathnames
58+ # Rebased version of
59+ # https://gitlab.com/embeddable-common-lisp/ecl/commit/ac5f011f57a85a38627af154bc3ee7580e7fecd4.patch
60+ name = "getcwd.patch";
61+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/ecl/patches/16.1.2-getcwd.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
62+ sha256 = "1fbi8gn7rv8nqff5mpaijsrch3k3z7qc5cn4h1vl8qrr8xwqlqhb";
63+ })
5664 ];
5765
5866 hardeningDisable = [ "format" ];
pkgs/development/libraries/arb/default.nix+9−1
@@ -1,4 +1,4 @@
1−{stdenv, fetchFromGitHub, mpir, gmp, mpfr, flint}:
1+{stdenv, fetchFromGitHub, fetchpatch, mpir, gmp, mpfr, flint}:
22stdenv.mkDerivation rec {
33 name = "${pname}-${version}";
44 pname = "arb";
@@ -17,6 +17,14 @@ stdenv.mkDerivation rec {
1717 "--with-flint=${flint}"
1818 ];
1919 doCheck = true;
20+ patches = [
21+ # https://github.com/fredrik-johansson/arb/pull/210, included in next release
22+ (fetchpatch {
23+ url = "https://patch-diff.githubusercontent.com/raw/fredrik-johansson/arb/pull/210.patch";
24+ name = "return-exact-zero-where-possible.patch";
25+ sha256 = "01j9npnpmwh4dla9i05qdn606hy34gy9bz7c9bbsqm7az3n7pxjg";
26+ })
27+ ];
2028 meta = {
2129 inherit version;
2230 description = ''A library for arbitrary-precision interval arithmetic'';
pkgs/development/libraries/libgap/default.nix+10−3
@@ -1,10 +1,17 @@
1−{stdenv, fetchurl, gmp}:
1+{ stdenv
2+, fetchurl
3+, gmp
4+}:
5+# will probably be obsolte (or at leat built from the upstream gap sources) soon (gap 4.9?). See
6+# - https://github.com/gap-system/gap/projects/5#card-6239828
7+# - https://github.com/markuspf/gap/issues/2
8+# - https://trac.sagemath.org/ticket/22626
29stdenv.mkDerivation rec {
310 name = "libgap-${version}";
11+ # Has to be the same version as "gap"
412 version = "4.8.6";
5− # or fetchFromGitHub(owner,repo,rev) or fetchgit(rev)
613 src = fetchurl {
7− url = "http://mirrors.mit.edu/sage/spkg/upstream/libgap/libgap-${version}.tar.gz";
14+ url = "mirror://sageupstream/libgap/libgap-${version}.tar.gz";
815 sha256 = "1h5fx5a55857w583ql7ly2jl49qyx9mvs7j5abys00ra9gzrpn5v";
916 };
1017 buildInputs = [gmp];
pkgs/development/libraries/linbox/default.nix−3
@@ -5,7 +5,6 @@
55, givaro
66, pkgconfig
77, openblas
8−, liblapack
98, fflas-ffpack
109, gmpxx
1110, optimize ? false # impure
@@ -30,7 +29,6 @@ stdenv.mkDerivation rec {
3029
3130 buildInputs = [
3231 givaro
33− (liblapack.override {shared = true;})
3432 openblas
3533 gmpxx
3634 fflas-ffpack
@@ -38,7 +36,6 @@ stdenv.mkDerivation rec {
3836
3937 configureFlags = [
4038 "--with-blas-libs=-lopenblas"
41− "--with-lapack-libs=-llapack"
4239 "--disable-optimization"
4340 ] ++ stdenv.lib.optionals (!optimize) [
4441 # disable SIMD instructions (which are enabled *when available* by default)
pkgs/development/libraries/science/math/lcalc/default.nix+1−1
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
1212 src = fetchurl {
1313 # original at http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-${version}.tar.gz, no longer available
1414 # "newer" version at google code https://code.google.com/archive/p/l-calc/source/default/source
15− url = "http://mirrors.mit.edu/sage/spkg/upstream/lcalc/lcalc-${version}.tar.bz2";
15+ url = "mirror://sageupstream/lcalc/lcalc-${version}.tar.bz2";
1616 sha256 = "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43";
1717 };
1818
pkgs/development/libraries/science/math/openblas/default.nix+2−3
@@ -76,11 +76,10 @@ let
7676 if blas64_ != null
7777 then blas64_
7878 else hasPrefix "x86_64" stdenv.system;
79−
80− version = "0.3.0";
8179in
82−stdenv.mkDerivation {
80+stdenv.mkDerivation rec {
8381 name = "openblas-${version}";
82+ version = "0.3.0";
8483 src = fetchurl {
8584 url = "https://github.com/xianyi/OpenBLAS/archive/v${version}.tar.gz";
8685 sha256 = "18giv3lsh8cva01z4rhsx8jvgliknni0jp7vxkc69qxb14vm8lfg";
pkgs/development/libraries/science/math/rankwidth/default.nix+1−1
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
88 name = "${pname}-${version}";
99
1010 src = fetchurl {
11− url = "http://mirrors.mit.edu/sage/spkg/upstream/rw/rw-${version}.tar.gz";
11+ url = "mirror://sageupstream/rw/rw-${version}.tar.gz";
1212 sha256 = "1rv2v42x2506x7f10349m1wpmmfxrv9l032bkminni2gbip9cjg0";
1313 };
1414
pkgs/development/libraries/science/math/rubiks/default.nix+1−1
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
1010 name = "${pname}-${version}";
1111
1212 src = fetchurl {
13− url = "http://mirrors.mit.edu/sage/spkg/upstream/rubiks/rubiks-${version}.tar.bz2";
13+ url = "mirror://sageupstream/rubiks/rubiks-${version}.tar.bz2";
1414 sha256 = "0zdmkb0j1kyspdpsszzb2k3279xij79jkx0dxd9f3ix1yyyg3yfq";
1515 };
1616
pkgs/development/libraries/science/math/sympow/default.nix+2−2
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
1010
1111 src = fetchurl {
1212 # Original website no longer reachable
13− url = "http://mirrors.mit.edu/sage/spkg/upstream/sympow/sympow-${version}.tar.bz2";
13+ url = "mirror://sageupstream/sympow/sympow-${version}.tar.bz2";
1414 sha256 = "0hphs7ia1wr5mydf288zvwj4svrymfpadcg3pi6w80km2yg5bm3c";
1515 };
1616
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
2626
2727 installPhase = ''
2828 runHook preInstall
29− install -d datafiles "$out/share/sympow/datafiles"
29+ install -D datafiles/* --target-directory "$out/share/sympow/datafiles/"
3030 install *.gp "$out/share/sympow/"
3131 install -Dm755 sympow "$out/share/sympow/sympow"
3232 install -D new_data "$out/bin/new_data"
pkgs/development/libraries/tachyon/default.nix+1
@@ -38,6 +38,7 @@ stdenv.mkDerivation rec {
3838 arch = if stdenv.system == "x86_64-linux" then "linux-64-thr" else
3939 if stdenv.system == "i686-linux" then "linux-thr" else
4040 if stdenv.system == "aarch64-linux" then "linux-arm-thr" else
41+ if stdenv.system == "armv7l-linux" then "linux-arm-thr" else
4142 if stdenv.system == "x86_64-darwin" then "macosx-thr" else
4243 if stdenv.system == "i686-darwin" then "macosx-64-thr" else
4344 if stdenv.system == "i686-cygwin" then "win32" else
pkgs/development/python-modules/cysignals/default.nix+9−1
@@ -2,9 +2,11 @@
22, fetchPypi
33, buildPythonPackage
44, cython
5−, sphinx
5+, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
66}:
77
8+assert pariSupport -> pari != null;
9+
810buildPythonPackage rec {
911 pname = "cysignals";
1012 version = "1.7.1";
@@ -14,6 +16,8 @@ buildPythonPackage rec {
1416 sha256 = "15nky8siwlc7s8v23vv4m0mnxa1z6jcs2qfr26m2mkw9j9g2na2j";
1517 };
1618
19+ # explicit check:
20+ # build/src/cysignals/implementation.c:27:2: error: #error "cysignals must be compiled without _FORTIFY_SOURCE"
1721 hardeningDisable = [
1822 "fortify"
1923 ];
@@ -26,6 +30,10 @@ buildPythonPackage rec {
2630 export PATH="$out/bin:$PATH"
2731 '';
2832
33+ buildInputs = lib.optionals pariSupport [
34+ pari
35+ ];
36+
2937 propagatedBuildInputs = [
3038 cython
3139 ];
pkgs/development/python-modules/flask-autoindex/default.nix+10−15
@@ -1,7 +1,6 @@
11{ stdenv
22, buildPythonPackage
3−, fetchpatch
4−, fetchPypi
3+, fetchFromGitHub
54, flask
65, flask-silk
76, future
@@ -9,11 +8,16 @@
98
109buildPythonPackage rec {
1110 pname = "Flask-AutoIndex";
12− version = "0.6";
11+ version = "2018-06-28";
1312
14− src = fetchPypi {
15− inherit pname version;
16− sha256 = "19b10mb1nrqfjyafki6wnrbn8mqi30bbyyiyvp5xssc74pciyfqs";
13+ # master fixes various issues (binary generation, flask syntax) and has no
14+ # major changes
15+ # new release requested: https://github.com/sublee/flask-autoindex/issues/38
16+ src = fetchFromGitHub {
17+ owner = "sublee";
18+ repo = "flask-autoindex";
19+ rev = "e3d449a89d56bf4c171c7c8d90af028e579782cf";
20+ sha256 = "0bwq2nid4h8vrxspggk064vra4wd804cl2ryyx4j2d1dyywmgjgy";
1721 };
1822
1923 propagatedBuildInputs = [
@@ -22,15 +26,6 @@ buildPythonPackage rec {
2226 future
2327 ];
2428
25− patches = [
26− # fix generated binary, see https://github.com/sublee/flask-autoindex/pull/32
27− (fetchpatch {
28− name = "fix_binary.patch";
29− url = "https://github.com/sublee/flask-autoindex/pull/32.patch";
30− sha256 = "1v2r0wvi7prhipjq89774svv6aqj0a13mdfj07pdlkpzfbf029dn";
31− })
32− ];
33−
3429 meta = with stdenv.lib; {
3530 description = "The mod_autoindex for Flask";
3631 longDescription = ''
pkgs/development/python-modules/flask-silk/default.nix+9−5
@@ -1,16 +1,20 @@
11{ stdenv
22, buildPythonPackage
3−, fetchPypi
3+, fetchFromGitHub
44, flask
55}:
66
77buildPythonPackage rec {
88 pname = "Flask-Silk";
9− version = "0.2";
9+ version = "2018-06-28";
1010
11− src = fetchPypi {
12− inherit pname version;
13− sha256 = "1gjzighx4f0w39sq9xvzr1kwb4y7yv9qrgzvli1p89gy16piz8l0";
11+ # master fixes flask import syntax and has no major changes
12+ # new release requested: https://github.com/sublee/flask-silk/pull/6
13+ src = fetchFromGitHub {
14+ owner = "sublee";
15+ repo = "flask-silk";
16+ rev = "3a8166550f9a0ec52edae7bf31d9818c4c15c531";
17+ sha256 = "0mplziqw52jfspas6vsm210lmxqqzgj0dxm8y0i3gpbyyykwcmh0";
1418 };
1519
1620 propagatedBuildInputs = [
pkgs/development/python-modules/sympy/default.nix+18−1
@@ -1,6 +1,7 @@
11{ lib
22, buildPythonPackage
33, fetchPypi
4+, fetchpatch
45, glibcLocales
56, mpmath
67}:
@@ -25,10 +26,26 @@ buildPythonPackage rec {
2526 export LANG="en_US.UTF-8"
2627 '';
2728
29+ patches = [
30+ # see https://trac.sagemath.org/ticket/20204 and https://github.com/sympy/sympy/issues/12825
31+ # There is also an upstream patch for this, included in the next release (PR #128826).
32+ # However that doesn't quite fix the issue yet. Apparently some changes by sage are required.
33+ # TODO re-evaluate the change once a new sympy version is released (open a sage trac ticket about
34+ # it).
35+ (fetchpatch {
36+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/sympy/patches/03_undeffun_sage.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
37+ sha256 = "1mh2va1rlgizgvx8yzqwgvbf5wvswarn511002b361mc8yy0bnhr";
38+ })
39+ (fetchpatch {
40+ url = "https://github.com/sympy/sympy/pull/13276.patch";
41+ sha256 = "1rz74b5c74vwh3pj9axxgh610i02l3555vvsvr4a15ya7siw7zxh";
42+ })
43+ ];
44+
2845 meta = {
2946 description = "A Python library for symbolic mathematics";
3047 homepage = http://www.sympy.org/;
3148 license = lib.licenses.bsd3;
3249 maintainers = with lib.maintainers; [ lovek323 ];
3350 };
34−}
51+}
pkgs/top-level/all-packages.nix+36−1
@@ -10099,6 +10099,24 @@ with pkgs;
1009910099
1010010100 libgadu = callPackage ../development/libraries/libgadu { };
1010110101
10102+ gap-libgap-compatible = let
10103+ version = "4r8p6";
10104+ pkgVer = "2016_11_12-14_25";
10105+ in
10106+ (gap.override { keepAllPackages = false; }).overrideAttrs (oldAttrs: {
10107+ name = "libgap-${oldAttrs.pname}-${version}";
10108+ src = fetchurl {
10109+ url = "https://www.gap-system.org/pub/gap/gap48/tar.bz2/gap${version}_${pkgVer}.tar.bz2";
10110+ sha256 = "19n2p1mdg33s2x9rs51iak7rgndc1cwr56jyqnah0g1ydgg1yh6b";
10111+ };
10112+ patches = (oldAttrs.patches or []) ++ [
10113+ # don't install any packages by default (needed for interop with libgap, probably obsolete with 4r10
10114+ (fetchpatch {
10115+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/gap/patches/nodefaultpackages.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
10116+ sha256 = "1xwj766m3axrxbkyx13hy3q8s2wkqxy3m6mgpwq3c3n4vk3v416v";
10117+ })
10118+ ];
10119+ });
1010210120 libgap = callPackage ../development/libraries/libgap { };
1010310121
1010410122 libgdata = gnome3.libgdata;
@@ -14586,18 +14604,26 @@ with pkgs;
1458614604
1458714605 camingo-code = callPackage ../data/fonts/camingo-code { };
1458814606
14607+ combinatorial_designs = callPackage ../data/misc/combinatorial_designs { };
14608+
14609+ conway_polynomials = callPackage ../data/misc/conway_polynomials { };
14610+
1458914611 dosis = callPackage ../data/fonts/dosis { };
1459014612
1459114613 dosemu_fonts = callPackage ../data/fonts/dosemu-fonts { };
1459214614
1459314615 eb-garamond = callPackage ../data/fonts/eb-garamond { };
1459414616
14617+ elliptic_curves = callPackage ../data/misc/elliptic_curves { };
14618+
1459514619 faba-icon-theme = callPackage ../data/icons/faba-icon-theme { };
1459614620
1459714621 faba-mono-icons = callPackage ../data/icons/faba-mono-icons { };
1459814622
1459914623 fixedsys-excelsior = callPackage ../data/fonts/fixedsys-excelsior { };
1460014624
14625+ graphs = callPackage ../data/misc/graphs { };
14626+
1460114627 emacs-all-the-icons-fonts = callPackage ../data/fonts/emacs-all-the-icons-fonts { };
1460214628
1460314629 emojione = callPackage ../data/fonts/emojione {
@@ -14802,8 +14828,14 @@ with pkgs;
1480214828 paratype-pt-sans = callPackage ../data/fonts/paratype-pt/sans.nix {};
1480314829 paratype-pt-serif = callPackage ../data/fonts/paratype-pt/serif.nix {};
1480414830
14831+ pari-galdata = callPackage ../data/misc/pari-galdata {};
14832+
14833+ pari-seadata-small = callPackage ../data/misc/pari-seadata-small {};
14834+
1480514835 poly = callPackage ../data/fonts/poly { };
1480614836
14837+ polytopes_db = callPackage ../data/misc/polytopes_db { };
14838+
1480714839 posix_man_pages = callPackage ../data/documentation/man-pages-posix { };
1480814840
1480914841 powerline-fonts = callPackage ../data/fonts/powerline-fonts { };
@@ -20351,7 +20383,10 @@ with pkgs;
2035120383
2035220384 petsc = callPackage ../development/libraries/science/math/petsc { };
2035320385
20354− sage = callPackage ../applications/science/math/sage { };
20386+ sage = callPackage ../applications/science/math/sage {
20387+ nixpkgs = pkgs;
20388+ };
20389+ sageWithDoc = sage.override { withDoc = true; };
2035520390
2035620391 suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { };
2035720392 suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {};