Merge pull request #39981 from timokau/sage-on-nixos

Sage on nixos
This commit is contained in:
Michael Raskin 2018-07-01 07:37:42 +00:00 committed by GitHub
commit 055a29c4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 4013 additions and 487 deletions

View File

@ -0,0 +1,117 @@
# Sage on nixos
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.
Don't feel discouraged to fix, simplify or improve things though. Here's a quick overview over the functions of the individual files:
- `sage-src.nix`
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.
- `env-locations.nix`
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`).
- `sage-env.nix`
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.
- `sagelib.nix`
Defines the main sage package (without setting the necessary environments or running any tests).
- `sage-with-env.nix`
Wraps sage in the necessary environment.
- `sage.nix`
Runs sages doctests.
- `sage-wrapper.nix`
Optionally tells sage where do find the docs.
- `sagedoc.nix`
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.
- `sagenb.nix`
The (semi deprecated) sage notebook.
- `default.nix`
Introduces necessary overrides, defines new packages and ties everything together (returning the `sage` package).
- `flask-oldsessions.nix`, `flask-openid.nix`, `python-openid.nix`
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.
- `pybrial.nix`
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.
- `openblas-pc.nix`
This creates a `.pc` file to be read by `pkg-config` that allows openblas to take on different roles, like `cblas` or `lapack`.
## The sage build is broken
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).
If the build broke as a result of a package update, try those solutions in order:
- 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`.
- 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).
- fix the problem yourself. First clone the sagemath source and then check out the sage version you want to patch:
```
[user@localhost ~]$ git clone git://github.com/sagemath/sage.git
[user@localhost ~]$ cd sage
[user@localhost sage]$ git checkout 8.2 # substitute the relevant version here
```
Then make the needed changes and generate a patch with `git diff`:
```
[user@localhost ~]$ <make changes>
[user@localhost ~]$ git diff -u > /path/to/nixpkgs/pkgs/applications/science/math/sage/patches/name-of-patch.patch
```
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.
- pin the package version in `default.nix` and add a note that explains why that is necessary.
## Proposing a sage patch
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.
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:
```
[user@localhost ~]$ git clone git://github.com/sagemath/sage.git
[user@localhost ~]$ cd sage
[user@localhost sage]$ git remote add trac git@trac.sagemath.org:sage.git -t master
[user@localhost sage]$ git checkout -b u/gh-<your-github-username>/<your-branch-name> develop
[user@localhost sage]$ <make changes>
[user@localhost sage]$ git add .
[user@localhost sage]$ git commit
[user@localhost sage]$ git show # review your changes
[user@localhost sage]$ git push --set-upstream trac u/gh-<your-github-username>/<your-branch-name>
```
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).
Now you can [create a new trac ticket](https://trac.sagemath.org/newticket).
- Write a description of the change
- set the type and component as appropriate
- write your real name in the "Authors" field
- write `u/gh-<your-github-username>/<your-branch-name>` in the "Branch" field
- click "Create ticket"
- click "Modify" on the top right of your ticket (for some reason you can only change the ticket status after you have created it)
- set the ticket status from `new` to `needs_review`
- click "Save changes"
Refer to sages [Developer's Guide](http://doc.sagemath.org/html/en/developer/index.html) for further details.
## I want to update sage
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.
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).
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.
## Well, that didn't help!
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).
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!

View File

@ -1,230 +1,211 @@
# TODO
# - consider writing a script to convert spkgs to nix packages, similar to vim
# or cabal2nix. This would allow a more efficient and "cleaner" build, greater
# flexibility and the possibility to select which dependencies to add and which
# to remove. It would also allow to use system packages for some dependencies
# and recompile others (optimized for the system) without recompiling everything.
# - add optdeps:
# - imagemagick
# - texlive full for documentation
# - ...
# - further seperate build outputs. Also maybe run `make doc`.
# Configure flags like --bindir and --libdir oculd also be used for that, see
# ./configure --help`.
# Other resources:
# - https://wiki.debian.org/DebianScience/Sage
# - https://github.com/cschwan/sage-on-gentoo
# - https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/sagemath
{ stdenv
, bash
, fetchurl
, perl
, gfortran6
, python
, autoreconfHook
, gettext
, which
, texlive
, texinfo
, hevea
, buildDocs ? false
, optimize ? false # optimize sage to the current system (obviously impure)
{ nixpkgs
, withDoc ? false
}:
stdenv.mkDerivation rec {
version = "8.1";
name = "sage-${version}";
let
inherit (nixpkgs) fetchpatch fetchurl symlinkJoin fetchFromGitHub callPackage nodePackages_8_x;
# Modified version of patchShebangs that patches to the sage-internal version if possible
# and falls back to the system version if not.
patchSageShebangs = ./patchSageShebangs.sh;
src = fetchurl {
# Note that the source is *not* fetched from github, since that doesn't
# the upstream folder with all the source tarballs of the spkgs.
# If those are not present they are fetched at build time, which breaks
# when building in a sandbox (and probably only works if you install the
# latest sage version).
urls = [
"http://mirrors.mit.edu/sage/src/sage-${version}.tar.gz"
"ftp://ftp.fu-berlin.de/unix/misc/sage/src/sage-${version}.tar.gz"
"http://sagemath.polytechnic.edu.na/src/sage-${version}.tar.gz"
"ftp://ftp.sun.ac.za/pub/mirrors/www.sagemath.org/src/sage-${version}.tar.gz"
"http://sagemath.mirror.ac.za/src/sage-${version}.tar.gz"
"https://ftp.leg.uct.ac.za/pub/packages/sage/src/sage-${version}.tar.gz"
"http://mirror.ufs.ac.za/sagemath/src/sage-${version}.tar.gz"
"https://mirrors-usa.go-parts.com/sage/sagemath/src/sage-${version}.tar.gz"
"http://www.cecm.sfu.ca/sage/src/sage-${version}.tar.gz"
"http://files.sagemath.org/src/sage-${version}.tar.gz"
"https://mirrors.xmission.com/sage/src/sage-${version}.tar.gz"
"http://sagemath.c3sl.ufpr.br/src/sage-${version}.tar.gz"
"http://linorg.usp.br/sage/src/sage-${version}.tar.gz"
"http://mirror.hust.edu.cn/sagemath/src/sage-${version}.tar.gz"
"https://ftp.iitm.ac.in/sage/src/sage-${version}.tar.gz"
"http://ftp.kaist.ac.kr/sage/src/sage-${version}.tar.gz"
"https://ftp.riken.jp/sagemath/src/sage-${version}.tar.gz"
"https://mirrors.tuna.tsinghua.edu.cn/sagemath/src/sage-${version}.tar.gz"
"https://mirrors.ustc.edu.cn/sagemath/src/sage-${version}.tar.gz"
"http://ftp.tsukuba.wide.ad.jp/software/sage/src/sage-${version}.tar.gz"
"https://ftp.yz.yamagata-u.ac.jp/pub/math/sage/src/sage-${version}.tar.gz"
"https://mirror.yandex.ru/mirrors/sage.math.washington.edu/src/sage-${version}.tar.gz"
"https://mirror.aarnet.edu.au/pub/sage/src/sage-${version}.tar.gz"
"https://sage.mirror.garr.it/mirrors/sage/src/sage-${version}.tar.gz"
"https://www.mirrorservice.org/sites/www.sagemath.org/src/sage-${version}.tar.gz"
"http://mirror.switch.ch/mirror/sagemath/src/sage-${version}.tar.gz"
"https://mirrors.up.pt/pub/sage/src/sage-${version}.tar.gz"
"http://www-ftp.lip6.fr/pub/math/sagemath/src/sage-${version}.tar.gz"
"http://ftp.ntua.gr/pub/sagemath/src/sage-${version}.tar.gz"
# https://trac.sagemath.org/ticket/15980 for tracking of python3 support
python = nixpkgs.python2.override {
packageOverrides = self: super: {
cypari2 = super.cypari2.override { inherit pari; };
cysignals = super.cysignals.override { inherit pari; };
cvxopt = super.cvxopt.override { inherit glpk; };
# https://github.com/sagemath/sagenb/issues/437
flask-babel = super.flask-babel.overridePythonAttrs (attrs: rec {
version = "0.9";
src = attrs.src.override {
inherit version;
sha256 = "0k7vk4k54y55ma0nx2k5s0phfqbriwslhy5shh3b0d046q7ibzaa";
};
doCheck = false;
});
# python packages that appear unmaintained and were not accepted into the nixpkgs
# tree because of that. These packages are only dependencies of the more-or-less
# deprecated sagenb. However sagenb is still a default dependency and the doctests
# depend on it.
# See https://github.com/NixOS/nixpkgs/pull/38787 for a discussion.
flask-oldsessions = self.callPackage ./flask-oldsessions.nix {};
flask-openid = self.callPackage ./flask-openid.nix {};
python-openid = self.callPackage ./python-openid.nix {};
pybrial = self.callPackage ./pybrial.nix {};
sagelib = self.callPackage ./sagelib.nix {
inherit flint ecl pari glpk eclib;
inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
linbox = nixpkgs.linbox.override { withSage = true; };
};
sagenb = self.callPackage ./sagenb.nix {
mathjax = nodePackages_8_x.mathjax;
};
sagedoc = self.callPackage ./sagedoc.nix {
inherit sage-src;
};
env-locations = self.callPackage ./env-locations.nix {
inherit pari_data ecl pari;
inherit singular;
three = nodePackages_8_x.three;
mathjax = nodePackages_8_x.mathjax;
};
sage-env = self.callPackage ./sage-env.nix {
inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv;
pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
};
sage-with-env = self.callPackage ./sage-with-env.nix {
inherit pari eclib pythonEnv;
inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
three = nodePackages_8_x.three;
};
sage = self.callPackage ./sage.nix { };
sage-wrapper = self.callPackage ./sage-wrapper.nix {
inherit sage-src withDoc;
};
};
};
openblas-blas-pc = callPackage ./openblas-pc.nix { name = "blas"; };
openblas-cblas-pc = callPackage ./openblas-pc.nix { name = "cblas"; };
openblas-lapack-pc = callPackage ./openblas-pc.nix { name = "lapack"; };
sage-src = callPackage ./sage-src.nix {};
pythonRuntimeDeps = with python.pkgs; [
sagelib
pybrial
sagenb
cvxopt
networkx
service-identity
psutil
sympy
fpylll
matplotlib
scipy
ipywidgets
rpy2
sphinx
typing
pillow
];
pythonEnv = python.buildEnv.override {
extraLibs = pythonRuntimeDeps;
ignoreCollisions = true;
} // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible
# needs to be rWrapper, standard "R" doesn't include default packages
rWrapper = nixpkgs.rWrapper.override {
# https://trac.sagemath.org/ticket/25674
R = nixpkgs.R.overrideAttrs (attrs: rec {
name = "R-3.4.4";
src = fetchurl {
url = "http://cran.r-project.org/src/base/R-3/${name}.tar.gz";
sha256 = "0dq3jsnwsb5j3fhl0wi3p5ycv8avf8s5j1y4ap3d2mkjmcppvsdk";
};
});
};
# update causes issues
# https://groups.google.com/forum/#!topic/sage-packaging/cS3v05Q0zso
# https://trac.sagemath.org/ticket/24735
singular = nixpkgs.singular.overrideAttrs (oldAttrs: {
name = "singular-4.1.0p3";
src = fetchurl {
url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-1-0/singular-4.1.0p3.tar.gz";
sha256 = "105zs3zk46b1cps403ap9423rl48824ap5gyrdgmg8fma34680a4";
};
});
# *not* to confuse with the python package "pynac"
# https://trac.sagemath.org/ticket/24838 (depends on arb update)
pynac = nixpkgs.pynac.override { inherit singular; };
eclib = nixpkgs.eclib.override { inherit pari; };
# With openblas (64 bit), the tests fail the same way as when sage is build with
# openblas instead of openblasCompat. Apparently other packages somehow use flints
# blas when it is available. Alternative would be to override flint to use
# openblasCompat.
flint = nixpkgs.flint.override { withBlas = false; };
# Multiple palp dimensions need to be available and sage expects them all to be
# in the same folder.
palp = symlinkJoin {
name = "palp-${nixpkgs.palp.version}";
paths = [
(nixpkgs.palp.override { dimensions = 4; doSymlink = false; })
(nixpkgs.palp.override { dimensions = 5; doSymlink = false; })
(nixpkgs.palp.override { dimensions = 6; doSymlink = true; })
(nixpkgs.palp.override { dimensions = 11; doSymlink = false; })
];
sha256 = "1cpcs1mr0yii64s152xmxyd450bfzjb22jjj0zh9y3n6g9alzpyq";
};
postPatch = ''
substituteAllInPlace src/bin/sage-env
bash=${bash} substituteAllInPlace build/bin/sage-spkg
'';
installPhase = ''
# Sage installs during first `make`, `make install` is no-op and just takes time.
'';
outputs = [ "out" ] ++ stdenv.lib.optionals (buildDocs) [ "doc" ];
buildInputs = [
bash # needed for the build
perl # needed for the build
python # needed for the build
gfortran6 # needed to build giac, openblas
autoreconfHook # needed to configure sage with prefix
gettext # needed to build the singular spkg
which # needed in configure of mpir
texinfo # needed to build maxima
] ++ stdenv.lib.optionals(buildDocs) [
hevea # needed to build the docs of the giac spkg
(texlive.combine { inherit (texlive)
scheme-basic
collection-pstricks # needed by giac
times # font needed by giac
stmaryrd # needed by giac
babel-greek # optional for giac, otherwise throws a bunch of latex command not founds
;
})
];
nativeBuildInputs = [ gfortran6 perl which ];
patches = [
# fix usages of /bin/rm
./spkg-singular.patch
# help python find the crypt library
# patches python3 and indirectly python2, since those installation files are symlinked
./spkg-python.patch
# fix usages of /usr/bin/perl
./spkg-git.patch
# fix usages of /bin/cp and add necessary argument to function call
./spkg-giac.patch
# environment
./env.patch
# adjust wrapper shebang and patch shebangs after each spkg build
./shebangs.patch
];
enableParallelBuilding = true;
hardeningDisable = [
"format" # needed to build palp, for lines like `printf(ctime(&_NFL->TIME))`
# TODO could be patched with `sed s|printf(ctime(\(.*\)))|%s... or fixed upstream
];
configureFlags = stdenv.lib.optionals(buildDocs) [ "--docdir=$(doc)" ];
preConfigure = ''
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
export HOME=/tmp/sage-home
export SAGE_ROOT="$PWD"
export SAGE_SRC="$PWD"
mkdir -p "$HOME"
mkdir -p "$out"
# we need to keep the source around
dir="$PWD"
cd ..
mv "$dir" "$out/sage-root"
export SAGE_SPKG_INSTALL_DOCS='no'
cd "$out/sage-root" # build in target dir, since `make` is also `make install`
''
+ stdenv.lib.optionalString (buildDocs) ''
mkdir -p "$doc"
export SAGE_DOC="$doc"
export SAGE_DOCBUILD_OPTS="--no-pdf-links -k"
''
+ stdenv.lib.optionalString (!optimize) ''
export SAGE_FAT_BINARY=yes
'';
buildFlags = if (buildDocs) then "doc" else "build";
# for reference: http://doc.sagemath.org/html/en/installation/source.html
preBuild = ''
# symlink python to make sure the shebangs are patched to the sage path
# while still being able to use python before building it
# (this is important because otherwise sage will try to install python
# packages globally later on)
ln -s "${python}/bin/python2" $out/bin/python2
ln -s "$out/bin/python2" $out/bin/python
touch $out/bin/python3
bash $patchSageShebangs .
'';
postBuild = ''
# Clean up
rm -r "$out/sage-root/upstream" # don't keep the sources of all the spkgs
rm -rf "$out/sage-root/src/build"
rm -rf "$out/sage-root/src/autom4te.cache"
rm -rf "$out/sage-root/src/config"
rm -rf "$out/sage-root/src/m4"
rm -rf "$out/sage-root/.git"
rm -r "$out/sage-root/logs"
rm -r "$out"/lib/python*/test
# Fix dependency cycle between out and doc
rm -f "$out/sage-root/config.log"
rm -f "$out/sage-root/config.status"
rm -f "$out/sage-root/build/make/Makefile-auto"
rm -f "$out/sage-home/.sage/gap/libgap-workspace-"*
# Make sure unnessessary packages don't end up in the build closure
find "$out" \
-iname 'config.log' \
-delete \
-or -iname 'Makefile' \
-delete
rm -f "$out/lib/R/etc/Renviron"
# Make sure all shebangs are properly patched
bash $patchSageShebangs $out
'';
# TODO there are some doctest failures, which seem harmless.
# We should figure out a way to fix the failures or ignore only those tests.
doCheck = false;
checkTarget = "ptestalllong"; # all long tests in parallell
preCheck = ''
export SAGE_TIMEOUT=0 # no timeout
export SAGE_TIMEOUT_LONG=0 # no timeout
'';
meta = {
homepage = http://www.sagemath.org;
description = "A free open source mathematics software system";
# taken from the homepage
longDescription = ''
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.
Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.
'';
license = stdenv.lib.licenses.gpl2Plus;
platforms = ["x86_64-linux" "i686-linux"];
maintainers = with stdenv.lib.maintainers; [ timokau ];
# Sage expects those in the same directory.
pari_data = symlinkJoin {
name = "pari_data";
paths = with nixpkgs; [
pari-galdata
pari-seadata-small
];
};
}
# https://trac.sagemath.org/ticket/22191
ecl = nixpkgs.ecl_16_1_2;
# sage currently uses an unreleased version of pari
pari = (nixpkgs.pari.override { withThread = false; }).overrideAttrs (attrs: rec {
version = "2.10-1280-g88fb5b3"; # on update remove pari-stackwarn patch from `sage-src.nix`
src = fetchurl {
url = "mirror://sageupstream/pari/pari-${version}.tar.gz";
sha256 = "19gbsm8jqq3hraanbmsvzkbh88iwlqbckzbnga3y76r7k42akn7m";
};
});
# https://trac.sagemath.org/ticket/24824
glpk = nixpkgs.glpk.overrideAttrs (attrs: rec {
version = "4.63";
name = "glpk-${version}";
src = fetchurl {
url = "mirror://gnu/glpk/${name}.tar.gz";
sha256 = "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci";
};
patches = (attrs.patches or []) ++ [
# Alternatively patch sage with debians
# https://sources.debian.org/data/main/s/sagemath/8.1-7/debian/patches/t-version-glpk-4.60-extra-hack-fixes.patch
# The header of that debian patch contains a good description of the issue. The gist of it:
# > If GLPK in Sage causes one error, and this is caught by Sage and recovered from, then
# > later (because upstream GLPK does not clear the "error" flag) Sage will append
# > all subsequent terminal output of GLPK into the error_message string but not
# > actually forward it to the user's terminal. This breaks some doctests.
(fetchpatch {
name = "error_recovery.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/error_recovery.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0z99z9gd31apb6x5n5n26411qzx0ma3s6dnznc4x61x86bhq31qf";
})
# Allow setting a exact verbosity level (OFF|ERR|ON|ALL|DBG)
(fetchpatch {
name = "exact_verbosity.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/glp_exact_verbosity.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "15gm5i2alqla3m463i1qq6jx6c0ns6lip7njvbhp37pgxg4s9hx8";
})
];
});
in
python.pkgs.sage-wrapper // {
doc = python.pkgs.sagedoc;
lib = python.pkgs.sagelib;
}

View File

@ -0,0 +1,46 @@
{ stdenv
, writeTextFile
, pari_data
, pari
, singular
, maxima-ecl
, conway_polynomials
, graphs
, elliptic_curves
, polytopes_db
, gap-libgap-compatible
, ecl
, combinatorial_designs
, jmol
, mathjax
, three
, cysignals
}:
writeTextFile rec {
name = "sage-env-locations";
destination = "/${name}";
text = ''
export GP_DATA_DIR="${pari_data}/share/pari"
export PARI_DATA_DIR="${pari_data}"
export GPHELP="${pari}/bin/gphelp"
export GPDOCDIR="${pari}/share/pari/doc"
export SINGULARPATH='${singular}/share/singular'
export SINGULAR_SO='${singular}/lib/libSingular.so'
export SINGULAR_EXECUTABLE='${singular}/bin/Singular'
export MAXIMA_FAS='${maxima-ecl}/lib/maxima/${maxima-ecl.version}/binary-ecl/maxima.fas'
export MAXIMA_PREFIX="${maxima-ecl}"
export CONWAY_POLYNOMIALS_DATA_DIR='${conway_polynomials}/share/conway_polynomials'
export GRAPHS_DATA_DIR='${graphs}/share/graphs'
export ELLCURVE_DATA_DIR='${elliptic_curves}/share/ellcurves'
export POLYTOPE_DATA_DIR='${polytopes_db}/share/reflexive_polytopes'
export GAP_ROOT_DIR='${gap-libgap-compatible}/share/gap/build-dir'
export ECLDIR='${ecl}/lib/ecl-${ecl.version}/'
export COMBINATORIAL_DESIGN_DATA_DIR="${combinatorial_designs}/share/combinatorial_designs"
export CREMONA_MINI_DATA_DIR="${elliptic_curves}/share/cremona"
export JMOL_DIR="${jmol}"
export MATHJAX_DIR="${mathjax}/lib/node_modules/mathjax"
export THREEJS_DIR="${three}/lib/node_modules/three"
export SAGE_INCLUDE_DIRECTORIES="${cysignals}/lib/python2.7/site-packages"
'';
}

View File

@ -1,22 +0,0 @@
diff --git a/src/bin/sage-env b/src/bin/sage-env
index ead308f861..ed8db9f9b7 100644
--- a/src/bin/sage-env
+++ b/src/bin/sage-env
@@ -111,6 +111,8 @@ resolvelinks() {
}
+SAGE_ROOT="@out@/sage-root"
+
# New value for SAGE_ROOT: either SAGE_ROOT (if given)
# or a guessed value based on pwd.
if [ -n "$SAGE_ROOT" ]; then
@@ -185,6 +187,8 @@ fi
export SAGE_ENV_SOURCED=$SAGE_ENV_VERSION
export SAGE_ROOT="$NEW_SAGE_ROOT"
+export SAGE_LOCAL='@out@/'
+export PYTHONPATH="@out@/lib/python2.7/site-packages:$PYTHONPATH"
# sage-env must know where the Sage's script files are.

View File

@ -1,11 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl go-pup
# Fetches a list of all available source mirrors from the sage homepage.
# Note that the list is sorted by country, but fetchurl doesn't offer an option
# to customize mirror preference.
curl -s http://www.sagemath.org/download-source.html \
| pup 'table#mirror' \
| pup 'a attr{href}' \
| sed -e 's/index\.html/sage-${version}.tar.gz/'

View File

@ -0,0 +1,36 @@
{ stdenv
, buildPythonPackage
, fetchFromGitHub
, python
, flask
}:
buildPythonPackage rec {
pname = "Flask-OldSessions";
version = "0.10";
# no artifact on pypi: https://github.com/mitsuhiko/flask-oldsessions/issues/1
src = fetchFromGitHub {
owner = "mitsuhiko";
repo = "flask-oldsessions";
rev = "${version}";
sha256 = "04b5m8njjiwld9a0zw55iqwvyjgwcpdbhz1cic8nyhgcmypbicqn";
};
propagatedBuildInputs = [
flask
];
# missing module flask.testsuite, probably assumes an old version of flask
doCheck = false;
checkPhase = ''
${python.interpreter} run-tests.py
'';
meta = with stdenv.lib; {
description = "Provides a session class that works like the one in Flask before 0.10.";
license = licenses.bsd2;
maintainers = with maintainers; [ timokau ];
homepage = https://github.com/mitsuhiko/flask-oldsessions;
};
}

View File

@ -0,0 +1,28 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, flask
, python-openid
}:
buildPythonPackage rec {
pname = "Flask-OpenID";
version = "1.2.5";
src = fetchPypi {
inherit pname version;
sha256 = "1aycwmwi7ilcaa5ab8hm0bp6323zl8z25q9ha0gwrl8aihfgx3ss";
};
propagatedBuildInputs = [
flask
python-openid
];
meta = with stdenv.lib; {
description = "Adds openid support to flask applications";
license = licenses.bsd2;
maintainers = with maintainers; [ timokau ];
homepage = https://pythonhosted.org/Flask-OpenID/;
};
}

View File

@ -0,0 +1,18 @@
{ stdenv
, openblasCompat
, writeTextFile
, name
}:
writeTextFile {
name = "openblas-${name}-pc-${openblasCompat.version}";
destination = "/lib/pkgconfig/${name}.pc";
text = ''
Name: ${name}
Version: ${openblasCompat.version}
Description: ${name} for SageMath, provided by the OpenBLAS package.
Cflags: -I${openblasCompat}/include
Libs: -L${openblasCompat}/lib -lopenblas
'';
}

View File

@ -1,51 +0,0 @@
# This is a slightly modified version of nix's default patchShebangs
dir="$1"
echo "patching sage internal script interpreter paths in $( readlink -f "$dir")"
find "$dir" -type f -perm -0100 | while read f; do
if [ "$(head -1 "$f" | head -c+2)" != '#!' ]; then
# missing shebang => not a script
continue
fi
oldInterpreterLine=$(head -1 "$f" | tail -c+3)
read -r oldPath arg0 args <<< "$oldInterpreterLine"
if $(echo "$oldPath" | grep -q "/bin/env$"); then
# Check for unsupported 'env' functionality:
# - options: something starting with a '-'
# - environment variables: foo=bar
if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
exit 1
fi
executable="$arg0"
else
if [ "$oldPath" = "" ]; then
# If no interpreter is specified linux will use /bin/sh. Set
# oldpath="/bin/sh" so that we get /nix/store/.../sh.
oldPath="/bin/sh"
fi
executable="$(basename "$oldPath")"
args="$arg0 $args"
fi
newPath="$(echo "$out/bin/$executable $args" | sed 's/[[:space:]]*$//')"
if [[ ! -x "$newPath" ]] ; then
newPath="$(command -v "$executable" || true)"
fi
# Strip trailing whitespace introduced when no arguments are present
newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"
if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
echo "$f: sage interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
# escape the escape chars so that sed doesn't interpret them
escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
fi
fi
done

View File

@ -0,0 +1,427 @@
commit c885927e25b29bd23869e02379c2918da430323e
Author: Timo Kaufmann <timokau@zoho.com>
Date: Sat Jun 30 02:26:15 2018 +0200
diff --git a/build/pkgs/arb/checksums.ini b/build/pkgs/arb/checksums.ini
index 1924ee03c3..9323b97391 100644
--- a/build/pkgs/arb/checksums.ini
+++ b/build/pkgs/arb/checksums.ini
@@ -1,4 +1,4 @@
tarball=arb-VERSION.tar.gz
-sha1=27476d0529e48a07d92da90bd0fb80dd18f443e3
-md5=733285d9705d10b8024e551ffa81952f
-cksum=2391183744
+sha1=44eda7bf8eaa666c45b1fc2c1b5bd08756d94b58
+md5=fa24de9fffe4394fb6a7a6792e2ecc5f
+cksum=3689220688
diff --git a/build/pkgs/arb/package-version.txt b/build/pkgs/arb/package-version.txt
index c8810e9bdb..fb2c0766b7 100644
--- a/build/pkgs/arb/package-version.txt
+++ b/build/pkgs/arb/package-version.txt
@@ -1 +1 @@
-2.12.0.p0
+2.13.0
diff --git a/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch b/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch
deleted file mode 100644
index 3e5c0e708b..0000000000
--- a/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-In newer binutils, ld options -r and -pie conflict.
-Patch due to Jörg-Volker Peetz
-(source : https://groups.google.com/d/msg/sage-devel/TduebNoZuBE/sEULolL0BQAJ),
-packaged by Emmanuel Charpentier
-
-diff -ru arb-2.8.1-orig/Makefile.subdirs arb-2.8.1-new/Makefile.subdirs
---- arb-2.8.1-orig/Makefile.subdirs 2015-12-31 17:30:01.000000000 +0100
-+++ arb-2.8.1-new/Makefile.subdirs 2016-11-07 18:50:34.540051779 +0100
-@@ -52,7 +52,7 @@
- $(QUIET_CC) $(CC) $(CFLAGS) $(INCS) -c $< -o $@ -MMD -MP -MF "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$@"
-
- $(MOD_LOBJ): $(LOBJS)
-- $(QUIET_CC) $(CC) $(ABI_FLAG) -Wl,-r $^ -o $@ -nostdlib
-+ $(QUIET_CC) $(CC) $(ABI_FLAG) -r $^ -o $@ -nostdlib
-
- -include $(LOBJS:.lo=.d)
-
diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
index 70d51e655a..00e7caea2c 100644
--- a/src/sage/rings/complex_arb.pyx
+++ b/src/sage/rings/complex_arb.pyx
@@ -857,14 +857,14 @@ class ComplexBallField(UniqueRepresentation, Field):
[0.500000000000000 +/- 2.09e-16]
sage: CBF.integral(lambda x, _: x.gamma(), 1 - CBF(i), 1 + CBF(i))
- [+/- 3.95e-15] + [1.5723926694981 +/- 4.53e-14]*I
+ [+/- 4...e-15] + [1.5723926694981 +/- 4...e-14]*I
sage: C = ComplexBallField(100)
sage: C.integral(lambda x, _: x.cos() * x.sin(), 0, 1)
[0.35403670913678559674939205737 +/- 8.89e-30]
sage: CBF.integral(lambda x, _: (x + x.exp()).sin(), 0, 8)
- [0.34740017266 +/- 6.36e-12]
+ [0.34740017266 +/- 6...e-12]
sage: C = ComplexBallField(2000)
sage: C.integral(lambda x, _: (x + x.exp()).sin(), 0, 8) # long time
@@ -879,14 +879,14 @@ class ComplexBallField(UniqueRepresentation, Field):
....: else:
....: return z.sqrt()
sage: CBF.integral(my_sqrt, -1 + CBF(i), -1 - CBF(i))
- [+/- 1.14e-14] + [-0.4752076627926 +/- 5.18e-14]*I
+ [+/- 1.14e-14] + [-0.4752076627926 +/- 5...e-14]*I
Note, though, that proper handling of the ``analytic`` flag is required
even when the path does not touch the branch cut::
sage: correct = CBF.integral(my_sqrt, 1, 2); correct
[1.21895141649746 +/- 3.73e-15]
- sage: RBF(integral(sqrt(x), x, 1, 2))
+ sage: RBF(integral(sqrt(x), x, 1, 2)) # long time
[1.21895141649746 +/- 1.79e-15]
sage: wrong = CBF.integral(lambda z, _: z.sqrt(), 1, 2) # WRONG!
sage: correct - wrong
@@ -915,9 +915,9 @@ class ComplexBallField(UniqueRepresentation, Field):
the integrand is unbounded::
sage: CBF.integral(lambda x, _: 1/x, -1, 1)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
sage: CBF.integral(lambda x, _: 1/x, 10^-1000, 1)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
sage: CBF.integral(lambda x, _: 1/x, 10^-1000, 1, abs_tol=1e-10)
[2302.5850930 +/- 1.26e-8]
@@ -928,14 +928,15 @@ class ComplexBallField(UniqueRepresentation, Field):
sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, abs_tol=1e-450)
[2.304377150950e-439 +/- 9.74e-452]
sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, abs_tol=0)
- [2.304377150949e-439 +/- 7.53e-452]
- sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, rel_tol=1e-4, abs_tol=0)
- [2.30438e-439 +/- 3.90e-445]
+ [2.304377150950e-439 +/- 7...e-452]
+ sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, rel_tol=1e-2, abs_tol=0)
+ [2.30438e-439 +/- 5.94e-445]
- sage: CBF.integral(lambda x, _: x*(1/x).sin(), 0, 1)
- [+/- 0.644]
- sage: CBF.integral(lambda x, _: x*(1/x).sin(), 0, 1, use_heap=True)
- [0.3785300 +/- 4.32e-8]
+ sage: epsi = CBF(1e-10)
+ sage: CBF.integral(lambda x, _: x*(1/x).sin(), epsi, 1)
+ [0.38 +/- 8.54e-3]
+ sage: CBF.integral(lambda x, _: x*(1/x).sin(), epsi, 1, use_heap=True)
+ [0.37853002 +/- 8.73e-9]
ALGORITHM:
@@ -951,12 +952,12 @@ class ComplexBallField(UniqueRepresentation, Field):
sage: i = QuadraticField(-1).gen()
sage: CBF.integral(lambda x, _: (1 + i*x).gamma(), -1, 1)
- [1.5723926694981 +/- 4.53e-14] + [+/- 3.95e-15]*I
+ [1.5723926694981 +/- 4...e-14] + [+/- 4...e-15]*I
- sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, rel_tol=1e-400)
- [0.459... +/- ...e-4...]
+ sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, rel_tol=1e-300)
+ [0.459... +/- ...e-3...]
sage: CBF.integral(lambda x, _: x.sin(), 0, 100, rel_tol=10)
- [+/- 7.61]
+ [0.138 +/- 5.53e-4]
sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, abs_tol=1e-400)
[0.459697... +/- ...e-4...]
@@ -2389,9 +2390,9 @@ cdef class ComplexBall(RingElement):
sage: ~CBF(i/3)
[-3.00000000000000 +/- 9.44e-16]*I
sage: ~CBF(0)
- [+/- inf]
+ nan
sage: ~CBF(RIF(10,11))
- [0.1 +/- 9.53e-3]
+ [0.1 +/- 9.10e-3]
"""
cdef ComplexBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -2512,9 +2513,9 @@ cdef class ComplexBall(RingElement):
sage: CBF(-2, 1)/CBF(1, 1/3)
[-1.500000000000000 +/- 8.83e-16] + [1.500000000000000 +/- 5.64e-16]*I
sage: CBF(2+I)/CBF(0)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
sage: CBF(1)/CBF(0)
- [+/- inf]
+ nan
sage: CBF(1)/CBF(RBF(0, 1.))
nan
"""
@@ -2543,9 +2544,9 @@ cdef class ComplexBall(RingElement):
sage: CBF(0)^(1/3)
0
sage: CBF(0)^(-1)
- [+/- inf]
+ nan
sage: CBF(0)^(-2)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
TESTS::
@@ -2656,12 +2657,12 @@ cdef class ComplexBall(RingElement):
sage: CBF(1).rising_factorial(5)
120.0000000000000
sage: CBF(1/3, 1/2).rising_factorial(300)
- [-3.87949484514e+612 +/- 5.23e+600] + [-3.52042209763e+612 +/- 5.55e+600]*I
+ [-3.87949484514e+612 +/- 5...e+600] + [-3.52042209763e+612 +/- 5...e+600]*I
sage: CBF(1).rising_factorial(-1)
nan
sage: CBF(1).rising_factorial(2**64)
- [+/- 2.30e+347382171305201370464]
+ [+/- 2.30e+347382171326740403407]
sage: ComplexBallField(128)(1).rising_factorial(2**64)
[2.343691126796861348e+347382171305201285713 +/- 4.71e+347382171305201285694]
sage: CBF(1/2).rising_factorial(CBF(2,3))
@@ -2700,7 +2701,7 @@ cdef class ComplexBall(RingElement):
[1.000000000000000 +/- 2.83e-16] + [-0.441271200305303 +/- 2.82e-16]*I
sage: CBF('inf').log()
- nan + nan*I
+ [+/- inf]
sage: CBF(2).log(0)
nan + nan*I
"""
@@ -2808,7 +2809,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(pi/2, 1/10).tan()
[+/- 2.87e-14] + [10.0333111322540 +/- 2.36e-14]*I
sage: CBF(pi/2).tan()
- [+/- inf]
+ nan
"""
cdef ComplexBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -2825,7 +2826,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(pi, 1/10).cot()
[+/- 5.74e-14] + [-10.0333111322540 +/- 2.81e-14]*I
sage: CBF(pi).cot()
- [+/- inf]
+ nan
"""
cdef ComplexBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -3211,9 +3212,9 @@ cdef class ComplexBall(RingElement):
1.000000000000000*I
sage: CBF(2+3*I).hypergeometric([1/4,1/3],[1/2])
- [0.7871684267473 +/- 7.34e-14] + [0.2749254173721 +/- 9.23e-14]*I
+ [0.7871684267473 +/- 7...e-14] + [0.2749254173721 +/- 9...e-14]*I
sage: CBF(2+3*I).hypergeometric([1/4,1/3],[1/2],regularized=True)
- [0.4441122268685 +/- 3.96e-14] + [0.1551100567338 +/- 5.75e-14]*I
+ [0.4441122268685 +/- 3...e-14] + [0.1551100567338 +/- 5...e-14]*I
sage: CBF(5).hypergeometric([2,3], [-5])
nan + nan*I
@@ -4041,9 +4042,9 @@ cdef class ComplexBall(RingElement):
sage: phi = CBF(1,1)
sage: (CBF.pi()/2).elliptic_e_inc(phi)
- [1.283840957898 +/- 3.23e-13] + [-0.5317843366915 +/- 7.79e-14]*I
+ [1.283840957898 +/- 3...e-13] + [-0.5317843366915 +/- 7...e-14]*I
sage: phi.elliptic_e()
- [1.2838409578982 +/- 5.90e-14] + [-0.5317843366915 +/- 3.35e-14]*I
+ [1.2838409578982 +/- 5...e-14] + [-0.5317843366915 +/- 3...e-14]*I
sage: phi = CBF(2, 3/7)
sage: (CBF.pi()/2).elliptic_e_inc(phi)
@@ -4312,8 +4313,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(10).laguerre_L(3, 2)
[-6.666666666667 +/- 4.15e-13]
sage: CBF(5,7).laguerre_L(CBF(2,3), CBF(1,-2))
- [5515.315030271 +/- 4.37e-10] + [-12386.942845271 +/- 5.47e-10]*I
-
+ [5515.315030271 +/- 4...e-10] + [-12386.942845271 +/- 5...e-10]*I
"""
cdef ComplexBall my_n = self._parent.coerce(n)
cdef ComplexBall my_m = self._parent.coerce(m)
@@ -4357,9 +4357,9 @@ cdef class ComplexBall(RingElement):
EXAMPLES::
sage: CBF(1/2).legendre_P(5)
- [0.08984375000000000 +/- 4.5...e-18]
+ [0.0898437500000000 +/- 7...e-17]
sage: CBF(1,2).legendre_P(CBF(2,3), CBF(0,1))
- [0.10996180744364 +/- 7.45e-15] + [0.14312767804055 +/- 8.38e-15]*I
+ [0.10996180744364 +/- 7.12e-15] + [0.14312767804055 +/- 8.07e-15]*I
sage: CBF(-10).legendre_P(5, 325/100)
[-22104403.487377 +/- 6.81e-7] + [53364750.687392 +/- 7.25e-7]*I
sage: CBF(-10).legendre_P(5, 325/100, type=3)
@@ -4393,9 +4393,9 @@ cdef class ComplexBall(RingElement):
sage: CBF(1/2).legendre_Q(5)
[0.55508089057168 +/- 2.79e-15]
sage: CBF(1,2).legendre_Q(CBF(2,3), CBF(0,1))
- [0.167678710 +/- 4.60e-10] + [-0.161558598 +/- 7.47e-10]*I
+ [0.167678710 +/- 3.91e-10] + [-0.161558598 +/- 6.77e-10]*I
sage: CBF(-10).legendre_Q(5, 325/100)
- [-83825154.36008 +/- 4.94e-6] + [-34721515.80396 +/- 5.40e-6]*I
+ [-83825154.36008 +/- 5.02e-6] + [-34721515.80396 +/- 5.42e-6]*I
sage: CBF(-10).legendre_Q(5, 325/100, type=3)
[-4.797306921692e-6 +/- 6.82e-19] + [-4.797306921692e-6 +/- 6.57e-19]*I
diff --git a/src/sage/rings/polynomial/polynomial_complex_arb.pyx b/src/sage/rings/polynomial/polynomial_complex_arb.pyx
index c436d4705b..ef611a566b 100644
--- a/src/sage/rings/polynomial/polynomial_complex_arb.pyx
+++ b/src/sage/rings/polynomial/polynomial_complex_arb.pyx
@@ -543,7 +543,7 @@ cdef class Polynomial_complex_arb(Polynomial):
sage: (1 - x/3).inverse_series_trunc(3)
([0.1111111111111111 +/- 5.99e-17])*x^2 + ([0.3333333333333333 +/- 7.04e-17])*x + 1.000000000000000
sage: x.inverse_series_trunc(1)
- [+/- inf]
+ nan
sage: Pol(0).inverse_series_trunc(2)
(nan + nan*I)*x + nan + nan*I
@@ -671,7 +671,7 @@ cdef class Polynomial_complex_arb(Polynomial):
sage: pol._sqrt_series(2)
([+/- 7.51e-3] + [+/- 0.501]*I)*x + [+/- 5.01e-3] + [+/- 1.01]*I
sage: x._sqrt_series(2)
- ([+/- inf] + [+/- inf]*I)*x
+ (nan + nan*I)*x
"""
cdef Polynomial_complex_arb res = self._new()
if n < 0:
diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
index c9f68e38d7..76e3037a9a 100644
--- a/src/sage/rings/real_arb.pyx
+++ b/src/sage/rings/real_arb.pyx
@@ -161,7 +161,7 @@ values and should be preferred::
sage: RBF(NaN) < RBF(infinity)
False
- sage: 1/RBF(0) <= RBF(infinity)
+ sage: RBF(0).add_error(infinity) <= RBF(infinity)
True
TESTS::
@@ -252,6 +252,8 @@ cdef void mpfi_to_arb(arb_t target, const mpfi_t source, const long precision):
(+infinity, +infinity)
sage: RBF(RIF(-infinity)).endpoints()
(-infinity, -infinity)
+ sage: RBF(RIF(-infinity, infinity)).endpoints()
+ (-infinity, +infinity)
sage: RIF(RBF(infinity)).endpoints()
(+infinity, +infinity)
sage: RIF(RBF(-infinity)).endpoints()
@@ -266,10 +268,11 @@ cdef void mpfi_to_arb(arb_t target, const mpfi_t source, const long precision):
if _do_sig(precision): sig_on()
mpfi_get_left(left, source)
mpfi_get_right(right, source)
- arb_set_interval_mpfr(target, left, right, precision)
- # Work around weakness of arb_set_interval_mpfr(tgt, inf, inf)
- if mpfr_equal_p(left, right):
- mag_zero(arb_radref(target))
+ if mpfr_inf_p(left) and mpfr_inf_p(right) and mpfr_sgn(left) < 0 < mpfr_sgn(right):
+ # Work around a weakness of arb_set_interval_mpfr(tgt, -inf, inf)
+ arb_zero_pm_inf(target)
+ else:
+ arb_set_interval_mpfr(target, left, right, precision)
if _do_sig(precision): sig_off()
mpfr_clear(left)
@@ -649,17 +652,15 @@ class RealBallField(UniqueRepresentation, Field):
EXAMPLES::
sage: RBF.some_elements()
- [1.000000000000000,
- [0.3333333333333333 +/- 7.04e-17],
+ [0, 1.000000000000000, [0.3333333333333333 +/- 7.04e-17],
[-4.733045976388941e+363922934236666733021124 +/- 3.46e+363922934236666733021108],
- [+/- inf],
- [+/- inf],
- nan]
+ [+/- inf], [+/- inf], [+/- inf], nan]
"""
import sage.symbolic.constants
- return [self(1), self(1)/3,
+ inf = self(sage.rings.infinity.Infinity)
+ return [self(0), self(1), self(1)/3,
-self(2)**(Integer(2)**80),
- self(sage.rings.infinity.Infinity), ~self(0),
+ inf, -inf, self.zero().add_error(inf),
self.element_class(self, sage.symbolic.constants.NotANumber())]
def _sum_of_products(self, terms):
@@ -881,7 +882,7 @@ class RealBallField(UniqueRepresentation, Field):
sage: RBF.gamma(5)
24.00000000000000
sage: RBF.gamma(10**20)
- [+/- 5.92e+1956570551809674821757]
+ [+/- 5.50e+1956570552410610660600]
sage: RBF.gamma(1/3)
[2.678938534707747 +/- 8.99e-16]
sage: RBF.gamma(-5)
@@ -2247,7 +2248,7 @@ cdef class RealBall(RingElement):
sage: inf = RBF(+infinity)
sage: other_inf = RBF(+infinity, 42.r)
sage: neg_inf = RBF(-infinity)
- sage: extended_line = 1/RBF(0)
+ sage: extended_line = RBF(0).add_error(infinity)
sage: exact_nan = inf - inf
sage: exact_nan.mid(), exact_nan.rad()
(NaN, 0.00000000)
@@ -2659,7 +2660,7 @@ cdef class RealBall(RingElement):
sage: ~RBF(5)
[0.2000000000000000 +/- 4.45e-17]
sage: ~RBF(0)
- [+/- inf]
+ nan
sage: RBF(RIF(-0.1,0.1))
[+/- 0.101]
@@ -2739,7 +2740,7 @@ cdef class RealBall(RingElement):
sage: RBF(pi)/RBF(e)
[1.155727349790922 +/- 8.43e-16]
sage: RBF(2)/RBF(0)
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -2765,7 +2766,7 @@ cdef class RealBall(RingElement):
sage: RBF(-1)^(1/3)
nan
sage: RBF(0)^(-1)
- [+/- inf]
+ nan
sage: RBF(-e)**RBF(pi)
nan
@@ -3129,7 +3130,7 @@ cdef class RealBall(RingElement):
sage: RBF(1).tan()
[1.557407724654902 +/- 3.26e-16]
sage: RBF(pi/2).tan()
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -3146,7 +3147,7 @@ cdef class RealBall(RingElement):
sage: RBF(1).cot()
[0.642092615934331 +/- 4.79e-16]
sage: RBF(pi).cot()
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -3257,7 +3258,7 @@ cdef class RealBall(RingElement):
sage: RBF(1).coth()
[1.313035285499331 +/- 4.97e-16]
sage: RBF(0).coth()
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()

View File

@ -0,0 +1,127 @@
diff --git a/src/doc/common/conf.py b/src/doc/common/conf.py
index 25f94f7b7d..9f6139ea4a 100644
--- a/src/doc/common/conf.py
+++ b/src/doc/common/conf.py
@@ -622,9 +622,9 @@ def call_intersphinx(app, env, node, contnode):
Check that the link from the thematic tutorials to the reference
manual is relative, see :trac:`20118`::
- sage: from sage.env import SAGE_DOC
- sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html")
- sage: for line in open(thematic_index).readlines():
+ sage: from sage.env import SAGE_DOC # optional - dochtml
+ sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html") # optional - dochtml
+ sage: for line in open(thematic_index).readlines(): # optional - dochtml
....: if "padics" in line:
....: sys.stdout.write(line)
<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>
diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
index 4236fd05e0..8e499cbaf7 100644
--- a/src/sage/doctest/control.py
+++ b/src/sage/doctest/control.py
@@ -87,7 +87,7 @@ class DocTestDefaults(SageObject):
self.sagenb = False
self.long = False
self.warn_long = None
- self.optional = set(['sage']) | auto_optional_tags
+ self.optional = set(['sage', 'dochtml']) | auto_optional_tags
self.randorder = None
self.global_iterations = 1 # sage-runtests default is 0
self.file_iterations = 1 # sage-runtests default is 0
@@ -343,7 +343,8 @@ class DocTestController(SageObject):
if not optionaltag_regex.search(o):
raise ValueError('invalid optional tag {!r}'.format(o))
- options.optional |= auto_optional_tags
+ if "sage" in options.optional:
+ options.optional |= auto_optional_tags
self.options = options
self.files = args
@@ -741,7 +742,7 @@ class DocTestController(SageObject):
sage: DC = DocTestController(DD, [dirname])
sage: DC.expand_files_into_sources()
sage: sorted(DC.sources[0].options.optional) # abs tol 1
- ['guava', 'magma', 'py3']
+ ['guava', 'magma']
We check that files are skipped appropriately::
@@ -968,7 +969,7 @@ class DocTestController(SageObject):
sage: from sage.doctest.control import DocTestDefaults, DocTestController
sage: DC = DocTestController(DocTestDefaults(), [])
sage: DC._optional_tags_string()
- 'sage'
+ 'dochtml,sage'
sage: DC = DocTestController(DocTestDefaults(optional="all,and,some,more"), [])
sage: DC._optional_tags_string()
'all'
diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
index 9255aa848f..cc4712d3ec 100644
--- a/src/sage/misc/sagedoc.py
+++ b/src/sage/misc/sagedoc.py
@@ -18,9 +18,9 @@ TESTS:
Check that argspecs of extension function/methods appear correctly,
see :trac:`12849`::
- sage: from sage.env import SAGE_DOC
- sage: docfilename = os.path.join(SAGE_DOC, 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html')
- sage: with open(docfilename) as fobj:
+ sage: from sage.env import SAGE_DOC # optional - dochtml
+ sage: docfilename = os.path.join(SAGE_DOC, 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html') # optional - dochtml
+ sage: with open(docfilename) as fobj: # optional - dochtml
....: for line in fobj:
....: if "#sage.symbolic.expression.Expression.numerical_approx" in line:
....: print(line)
@@ -790,11 +790,12 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='',
::
- sage: len(_search_src_or_doc('src', r'matrix\(', 'incidence_structures', 'self', 'combinat', interact=False).splitlines()) > 1
+ sage: from sage.misc.sagedoc import _search_src_or_doc # optional - dochtml
+ sage: len(_search_src_or_doc('src', r'matrix\(', 'incidence_structures', 'self', 'combinat', interact=False).splitlines()) > 1 # optional - dochtml
True
- sage: 'abvar/homology' in _search_src_or_doc('doc', 'homology', 'variety', interact=False) # long time (4s on sage.math, 2012)
+ sage: 'abvar/homology' in _search_src_or_doc('doc', 'homology', 'variety', interact=False) # optional - dochtml, long time (4s on sage.math, 2012)
True
- sage: 'divisors' in _search_src_or_doc('src', '^ *def prime', interact=False)
+ sage: 'divisors' in _search_src_or_doc('src', '^ *def prime', interact=False) # optional - dochtml
True
"""
# process keywords
@@ -1160,9 +1161,9 @@ def search_doc(string, extra1='', extra2='', extra3='', extra4='',
counting the length of ``search_doc('tree',
interact=False).splitlines()`` gives the number of matches. ::
- sage: len(search_doc('tree', interact=False).splitlines()) > 4000 # long time
+ sage: len(search_doc('tree', interact=False).splitlines()) > 4000 # optional - dochtml, long time
True
- sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 2000 # long time
+ sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 2000 # optional - dochtml, long time
True
"""
return _search_src_or_doc('doc', string, extra1=extra1, extra2=extra2,
@@ -1332,9 +1333,9 @@ class _sage_doc:
EXAMPLES::
- sage: browse_sage_doc._open("reference", testing=True)[0] # indirect doctest
+ sage: browse_sage_doc._open("reference", testing=True)[0] # optional - dochtml, indirect doctest
'http://localhost:8000/doc/live/reference/index.html'
- sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47]
+ sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] # optional - dochtml
'Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring'
"""
def __init__(self):
@@ -1494,9 +1495,9 @@ class _sage_doc:
EXAMPLES::
- sage: browse_sage_doc._open("reference", testing=True)[0]
+ sage: browse_sage_doc._open("reference", testing=True)[0] # optional - dochtml
'http://localhost:8000/doc/live/reference/index.html'
- sage: browse_sage_doc._open("tutorial", testing=True)[1]
+ sage: browse_sage_doc._open("tutorial", testing=True)[1] # optional - dochtml
'.../html/en/tutorial/index.html'
"""
url = self._base_url + os.path.join(name, "index.html")

View File

@ -0,0 +1,98 @@
diff --git a/src/sage/libs/eclib/interface.py b/src/sage/libs/eclib/interface.py
index f77000c478..9d17d412ae 100644
--- a/src/sage/libs/eclib/interface.py
+++ b/src/sage/libs/eclib/interface.py
@@ -1014,7 +1014,7 @@ class mwrank_MordellWeil(SageObject):
WARNING: saturation at primes p > 2 will not be done;
...
Gained index 2
- New regulator = 93.857300720636393209
+ New regulator = 93.85730...
(False, 2, '[ ]')
sage: EQ.points()
[[-2, 3, 1], [2707496766203306, 864581029138191, 2969715140223272], [-13422227300, -49322830557, 12167000000]]
@@ -1025,7 +1025,7 @@ class mwrank_MordellWeil(SageObject):
WARNING: saturation at primes p > 3 will not be done;
...
Gained index 3
- New regulator = 10.4285889689595992455
+ New regulator = 10.42858...
(False, 3, '[ ]')
sage: EQ.points()
[[-2, 3, 1], [-14, 25, 8], [-13422227300, -49322830557, 12167000000]]
@@ -1036,7 +1036,7 @@ class mwrank_MordellWeil(SageObject):
WARNING: saturation at primes p > 5 will not be done;
...
Gained index 5
- New regulator = 0.417143558758383969818
+ New regulator = 0.41714...
(False, 5, '[ ]')
sage: EQ.points()
[[-2, 3, 1], [-14, 25, 8], [1, -1, 1]]
@@ -1221,7 +1221,7 @@ class mwrank_MordellWeil(SageObject):
WARNING: saturation at primes p > 2 will not be done;
...
Gained index 2
- New regulator = 93.857300720636393209
+ New regulator = 93.85730...
(False, 2, '[ ]')
sage: EQ
Subgroup of Mordell-Weil group: [[-2:3:1], [2707496766203306:864581029138191:2969715140223272], [-13422227300:-49322830557:12167000000]]
@@ -1235,7 +1235,7 @@ class mwrank_MordellWeil(SageObject):
WARNING: saturation at primes p > 3 will not be done;
...
Gained index 3
- New regulator = 10.4285889689595992455
+ New regulator = 10.42858...
(False, 3, '[ ]')
sage: EQ
Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [-13422227300:-49322830557:12167000000]]
@@ -1249,7 +1249,7 @@ class mwrank_MordellWeil(SageObject):
WARNING: saturation at primes p > 5 will not be done;
...
Gained index 5
- New regulator = 0.417143558758383969818
+ New regulator = 0.41714...
(False, 5, '[ ]')
sage: EQ
Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]]
diff --git a/src/sage/libs/eclib/mwrank.pyx b/src/sage/libs/eclib/mwrank.pyx
index a4f89e1ca5..f8a22d2f55 100644
--- a/src/sage/libs/eclib/mwrank.pyx
+++ b/src/sage/libs/eclib/mwrank.pyx
@@ -1234,9 +1234,9 @@ cdef class _two_descent:
sage: D2.saturate()
Searching for points (bound = 8)...done:
found points which generate a subgroup of rank 3
- and regulator 0.417143558758383969817119544618093396749810106098479
+ and regulator 0.41714...
Processing points found during 2-descent...done:
- now regulator = 0.417143558758383969817119544618093396749810106098479
+ now regulator = 0.41714...
No saturation being done
sage: D2.getbasis()
'[[1:-1:1], [-2:3:1], [-14:25:8]]'
@@ -1281,9 +1281,9 @@ cdef class _two_descent:
sage: D2.saturate()
Searching for points (bound = 8)...done:
found points which generate a subgroup of rank 3
- and regulator 0.417143558758383969817119544618093396749810106098479
+ and regulator 0.41714...
Processing points found during 2-descent...done:
- now regulator = 0.417143558758383969817119544618093396749810106098479
+ now regulator = 0.41714...
No saturation being done
sage: D2.getbasis()
'[[1:-1:1], [-2:3:1], [-14:25:8]]'
@@ -1329,9 +1329,9 @@ cdef class _two_descent:
sage: D2.saturate()
Searching for points (bound = 8)...done:
found points which generate a subgroup of rank 3
- and regulator 0.417143558758383969817119544618093396749810106098479
+ and regulator 0.41714...
Processing points found during 2-descent...done:
- now regulator = 0.417143558758383969817119544618093396749810106098479
+ now regulator = 0.41714...
No saturation being done
sage: D2.getbasis()
'[[1:-1:1], [-2:3:1], [-14:25:8]]'

View File

@ -0,0 +1,12 @@
diff --git a/src/sage/all.py b/src/sage/all.py
index 14cec431f1..25a35a0522 100644
--- a/src/sage/all.py
+++ b/src/sage/all.py
@@ -310,6 +310,7 @@ warnings.filters.remove(('ignore', None, DeprecationWarning, None, 0))
# Ignore all deprecations from IPython etc.
warnings.filterwarnings('ignore',
module='.*(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic)')
+warnings.filterwarnings('ignore', "The 'normed' kwarg is deprecated, and has been replaced by the 'density' kwarg.") # matplotlib normed deprecation
# However, be sure to keep OUR deprecation warnings
warnings.filterwarnings('default',
'[\s\S]*See http://trac.sagemath.org/[0-9]* for details.')

View File

@ -0,0 +1,48 @@
diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
index 961c20aaac..3d601d8939 100644
--- a/src/sage/interfaces/maxima_abstract.py
+++ b/src/sage/interfaces/maxima_abstract.py
@@ -1743,7 +1743,7 @@ class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement):
sage: y,d = var('y,d')
sage: f = function('f')
sage: latex(maxima(derivative(f(x*y), x)))
- \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}
+ \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}
sage: latex(maxima(derivative(f(x,y,d), d,x,x,y)))
{{{\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)
sage: latex(maxima(d/(d-2)))
diff --git a/src/sage/manifolds/differentiable/metric.py b/src/sage/manifolds/differentiable/metric.py
index 3cd6ad3235..1e18af1a6b 100644
--- a/src/sage/manifolds/differentiable/metric.py
+++ b/src/sage/manifolds/differentiable/metric.py
@@ -993,7 +993,7 @@ class PseudoRiemannianMetric(TensorField):
2-dimensional differentiable manifold S^2
sage: g.riemann()[:]
[[[[0, 0], [0, 0]], [[0, sin(th)^2], [-sin(th)^2, 0]]],
- [[[0, (cos(th)^2 - 1)/sin(th)^2], [1, 0]], [[0, 0], [0, 0]]]]
+ [[[0, -1], [1, 0]], [[0, 0], [0, 0]]]]
In dimension 2, the Riemann tensor can be expressed entirely in terms of
the Ricci scalar `r`:
diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
index dfb8751467..27402e54ab 100644
--- a/src/sage/symbolic/expression.pyx
+++ b/src/sage/symbolic/expression.pyx
@@ -7154,7 +7154,7 @@ cdef class Expression(CommutativeRingElement):
sage: ex = lcm(sin(x)^2 - 1, sin(x)^2 + sin(x)); ex
(sin(x)^2 + sin(x))*(sin(x)^2 - 1)/(sin(x) + 1)
sage: ex.simplify_full()
- -cos(x)^2*sin(x)
+ sin(x)^3 - sin(x)
TESTS:
@@ -10004,7 +10004,7 @@ cdef class Expression(CommutativeRingElement):
sage: f=tan(3*x)
sage: f.simplify_trig()
- (4*cos(x)^2 - 1)*sin(x)/(4*cos(x)^3 - 3*cos(x))
+ -(4*cos(x)^2 - 1)*sin(x)/(4*cos(x)*sin(x)^2 - cos(x))
sage: f.simplify_trig(False)
sin(3*x)/cos(3*x)

View File

@ -0,0 +1,812 @@
diff --git a/src/doc/en/faq/faq-usage.rst b/src/doc/en/faq/faq-usage.rst
index 79b4205fd3..9a89bd2136 100644
--- a/src/doc/en/faq/faq-usage.rst
+++ b/src/doc/en/faq/faq-usage.rst
@@ -338,7 +338,7 @@ ints. For example::
sage: RealNumber = float; Integer = int
sage: from scipy import stats
sage: stats.ttest_ind(list([1,2,3,4,5]),list([2,3,4,5,.6]))
- Ttest_indResult(statistic=0.076752955645333687, pvalue=0.94070490247380478)
+ Ttest_indResult(statistic=0.0767529..., pvalue=0.940704...)
sage: stats.uniform(0,15).ppf([0.5,0.7])
array([ 7.5, 10.5])
diff --git a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
index 314811c42b..e5f54ec4c2 100644
--- a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
+++ b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
@@ -48,11 +48,13 @@ we could do the following.
sage: B = numpy.array([1.0]*5)
sage: B.shape=(5,1)
sage: print(B)
- [[ 1.]
- [ 1.]
- [ 1.]
- [ 1.]
- [ 1.]]
+ [[1.]
+ [1.]
+ [1.]
+ [1.]
+ [1.]]
+
+
sage: print(A)
[ 2.00e+00 3.00e+00 0 0 0 ]
[ 3.00e+00 0 4.00e+00 0 6.00e+00]
diff --git a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
index 5b89cd75ee..e50b2ea5d4 100644
--- a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
+++ b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
@@ -84,7 +84,7 @@ well as take slices
sage: l[3]
3.0
sage: l[3:6]
- array([ 3., 4., 5.])
+ array([3., 4., 5.])
You can do basic arithmetic operations
@@ -147,11 +147,11 @@ also do matrix vector multiplication, and matrix addition
sage: n = numpy.matrix([[1,2],[3,4]],dtype=float)
sage: v = numpy.array([[1],[2]],dtype=float)
sage: n*v
- matrix([[ 5.],
- [ 11.]])
+ matrix([[ 5.],
+ [11.]])
sage: n+n
- matrix([[ 2., 4.],
- [ 6., 8.]])
+ matrix([[2., 4.],
+ [6., 8.]])
If ``n`` was created with :meth:`numpy.array`, then to do matrix vector
multiplication, you would use ``numpy.dot(n,v)``.
@@ -170,11 +170,11 @@ to manipulate
22., 23., 24.])
sage: n.shape=(5,5)
sage: n
- array([[ 0., 1., 2., 3., 4.],
- [ 5., 6., 7., 8., 9.],
- [ 10., 11., 12., 13., 14.],
- [ 15., 16., 17., 18., 19.],
- [ 20., 21., 22., 23., 24.]])
+ array([[ 0., 1., 2., 3., 4.],
+ [ 5., 6., 7., 8., 9.],
+ [10., 11., 12., 13., 14.],
+ [15., 16., 17., 18., 19.],
+ [20., 21., 22., 23., 24.]])
This changes the one-dimensional array into a `5\times 5` array.
@@ -187,8 +187,8 @@ NumPy arrays can be sliced as well
sage: n=numpy.array(range(25),dtype=float)
sage: n.shape=(5,5)
sage: n[2:4,1:3]
- array([[ 11., 12.],
- [ 16., 17.]])
+ array([[11., 12.],
+ [16., 17.]])
It is important to note that the sliced matrices are references to
the original
@@ -224,8 +224,8 @@ Some particularly useful commands are
sage: x=numpy.arange(0,2,.1,dtype=float)
sage: x
- 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, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
+ 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,
+ 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
You can see that :meth:`numpy.arange` creates an array of floats increasing by 0.1
from 0 to 2. There is a useful command :meth:`numpy.r_` that is best explained by example
@@ -240,10 +240,11 @@ from 0 to 2. There is a useful command :meth:`numpy.r_` that is best explained b
sage: Integer=int
sage: n=r_[0.0:5.0]
sage: n
- array([ 0., 1., 2., 3., 4.])
+ array([0., 1., 2., 3., 4.])
sage: n=r_[0.0:5.0, [0.0]*5]
sage: n
- array([ 0., 1., 2., 3., 4., 0., 0., 0., 0., 0.])
+ array([0., 1., 2., 3., 4., 0., 0., 0., 0., 0.])
+
:meth:`numpy.r_` provides a shorthand for constructing NumPy arrays efficiently.
Note in the above ``0.0:5.0`` was shorthand for ``0.0, 1.0, 2.0, 3.0, 4.0``.
@@ -255,7 +256,7 @@ intervals. We can do this as follows
::
sage: r_[0.0:5.0:11*j]
- array([ 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. ])
+ array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. ])
The notation ``0.0:5.0:11*j`` expands to a list of 11 equally space
points between 0 and 5 including both endpoints. Note that ``j`` is the
@@ -287,23 +288,23 @@ an equally spaced grid with `\Delta x = \Delta y = .25` for
sage: y=numpy.r_[0.0:1.0:5*j]
sage: xx,yy= meshgrid(x,y)
sage: xx
- array([[ 0. , 0.25, 0.5 , 0.75, 1. ],
- [ 0. , 0.25, 0.5 , 0.75, 1. ],
- [ 0. , 0.25, 0.5 , 0.75, 1. ],
- [ 0. , 0.25, 0.5 , 0.75, 1. ],
- [ 0. , 0.25, 0.5 , 0.75, 1. ]])
+ array([[0. , 0.25, 0.5 , 0.75, 1. ],
+ [0. , 0.25, 0.5 , 0.75, 1. ],
+ [0. , 0.25, 0.5 , 0.75, 1. ],
+ [0. , 0.25, 0.5 , 0.75, 1. ],
+ [0. , 0.25, 0.5 , 0.75, 1. ]])
sage: yy
- array([[ 0. , 0. , 0. , 0. , 0. ],
- [ 0.25, 0.25, 0.25, 0.25, 0.25],
- [ 0.5 , 0.5 , 0.5 , 0.5 , 0.5 ],
- [ 0.75, 0.75, 0.75, 0.75, 0.75],
- [ 1. , 1. , 1. , 1. , 1. ]])
+ array([[0. , 0. , 0. , 0. , 0. ],
+ [0.25, 0.25, 0.25, 0.25, 0.25],
+ [0.5 , 0.5 , 0.5 , 0.5 , 0.5 ],
+ [0.75, 0.75, 0.75, 0.75, 0.75],
+ [1. , 1. , 1. , 1. , 1. ]])
sage: f(xx,yy)
- array([[ 0. , 0.0625, 0.25 , 0.5625, 1. ],
- [ 0.0625, 0.125 , 0.3125, 0.625 , 1.0625],
- [ 0.25 , 0.3125, 0.5 , 0.8125, 1.25 ],
- [ 0.5625, 0.625 , 0.8125, 1.125 , 1.5625],
- [ 1. , 1.0625, 1.25 , 1.5625, 2. ]])
+ array([[0. , 0.0625, 0.25 , 0.5625, 1. ],
+ [0.0625, 0.125 , 0.3125, 0.625 , 1.0625],
+ [0.25 , 0.3125, 0.5 , 0.8125, 1.25 ],
+ [0.5625, 0.625 , 0.8125, 1.125 , 1.5625],
+ [1. , 1.0625, 1.25 , 1.5625, 2. ]])
You can see that :meth:`numpy.meshgrid` produces a pair of matrices, here denoted
`xx` and `yy`, such that `(xx[i,j],yy[i,j])` has coordinates
@@ -324,7 +325,7 @@ equation `Ax=b` do
sage: b=numpy.array(range(1,6))
sage: x=linalg.solve(A,b)
sage: numpy.dot(A,x)
- array([ 1., 2., 3., 4., 5.])
+ array([1., 2., 3., 4., 5.])
This creates a random 5x5 matrix ``A``, and solves `Ax=b` where
``b=[0.0,1.0,2.0,3.0,4.0]``. There are many other routines in the :mod:`numpy.linalg`
diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx
index df85cce43d..34ea164be0 100644
--- a/src/sage/calculus/riemann.pyx
+++ b/src/sage/calculus/riemann.pyx
@@ -1191,30 +1191,30 @@ cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values,
sage: zval = numpy.array([[0, 1, 1000],[.2+.3j,1,-.3j],[0,0,0]],dtype = numpy.complex128)
sage: deriv = numpy.array([[.1]],dtype = numpy.float64)
sage: complex_to_spiderweb(zval, deriv,deriv, 4,4,[0,0,0],1,False,0.001)
- array([[[ 1., 1., 1.],
- [ 1., 1., 1.],
- [ 1., 1., 1.]],
+ array([[[1., 1., 1.],
+ [1., 1., 1.],
+ [1., 1., 1.]],
<BLANKLINE>
- [[ 1., 1., 1.],
- [ 0., 0., 0.],
- [ 1., 1., 1.]],
+ [[1., 1., 1.],
+ [0., 0., 0.],
+ [1., 1., 1.]],
<BLANKLINE>
- [[ 1., 1., 1.],
- [ 1., 1., 1.],
- [ 1., 1., 1.]]])
+ [[1., 1., 1.],
+ [1., 1., 1.],
+ [1., 1., 1.]]])
sage: complex_to_spiderweb(zval, deriv,deriv, 4,4,[0,0,0],1,True,0.001)
- array([[[ 1. , 1. , 1. ],
- [ 1. , 0.05558355, 0.05558355],
- [ 0.17301243, 0. , 0. ]],
+ array([[[1. , 1. , 1. ],
+ [1. , 0.05558355, 0.05558355],
+ [0.17301243, 0. , 0. ]],
<BLANKLINE>
- [[ 1. , 0.96804683, 0.48044583],
- [ 0. , 0. , 0. ],
- [ 0.77351965, 0.5470393 , 1. ]],
+ [[1. , 0.96804683, 0.48044583],
+ [0. , 0. , 0. ],
+ [0.77351965, 0.5470393 , 1. ]],
<BLANKLINE>
- [[ 1. , 1. , 1. ],
- [ 1. , 1. , 1. ],
- [ 1. , 1. , 1. ]]])
+ [[1. , 1. , 1. ],
+ [1. , 1. , 1. ],
+ [1. , 1. , 1. ]]])
"""
cdef Py_ssize_t i, j, imax, jmax
cdef FLOAT_T x, y, mag, arg, width, target, precision, dmag, darg
@@ -1279,14 +1279,14 @@ cpdef complex_to_rgb(np.ndarray[COMPLEX_T, ndim = 2] z_values):
sage: from sage.calculus.riemann import complex_to_rgb
sage: import numpy
sage: complex_to_rgb(numpy.array([[0, 1, 1000]], dtype = numpy.complex128))
- array([[[ 1. , 1. , 1. ],
- [ 1. , 0.05558355, 0.05558355],
- [ 0.17301243, 0. , 0. ]]])
+ array([[[1. , 1. , 1. ],
+ [1. , 0.05558355, 0.05558355],
+ [0.17301243, 0. , 0. ]]])
sage: complex_to_rgb(numpy.array([[0, 1j, 1000j]], dtype = numpy.complex128))
- array([[[ 1. , 1. , 1. ],
- [ 0.52779177, 1. , 0.05558355],
- [ 0.08650622, 0.17301243, 0. ]]])
+ array([[[1. , 1. , 1. ],
+ [0.52779177, 1. , 0.05558355],
+ [0.08650622, 0.17301243, 0. ]]])
TESTS::
diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py
index 61b1003002..4baee9cbbd 100644
--- a/src/sage/combinat/fully_packed_loop.py
+++ b/src/sage/combinat/fully_packed_loop.py
@@ -72,11 +72,11 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False):
sage: _make_color_list(5, ['blue', 'red'])
['blue', 'red', 'blue', 'red', 'blue']
sage: _make_color_list(5, color_map='summer')
- [(0.0, 0.5, 0.40000000000000002),
- (0.25098039215686274, 0.62549019607843137, 0.40000000000000002),
- (0.50196078431372548, 0.75098039215686274, 0.40000000000000002),
- (0.75294117647058822, 0.87647058823529411, 0.40000000000000002),
- (1.0, 1.0, 0.40000000000000002)]
+ [(0.0, 0.5, 0.4),
+ (0.25098039215686274, 0.6254901960784314, 0.4),
+ (0.5019607843137255, 0.7509803921568627, 0.4),
+ (0.7529411764705882, 0.8764705882352941, 0.4),
+ (1.0, 1.0, 0.4)]
sage: _make_color_list(8, ['blue', 'red'], randomize=True)
['blue', 'blue', 'red', 'blue', 'red', 'red', 'red', 'blue']
"""
diff --git a/src/sage/finance/time_series.pyx b/src/sage/finance/time_series.pyx
index c37700d14e..49b7298d0b 100644
--- a/src/sage/finance/time_series.pyx
+++ b/src/sage/finance/time_series.pyx
@@ -109,8 +109,8 @@ cdef class TimeSeries:
sage: import numpy
sage: v = numpy.array([[1,2], [3,4]], dtype=float); v
- array([[ 1., 2.],
- [ 3., 4.]])
+ array([[1., 2.],
+ [3., 4.]])
sage: finance.TimeSeries(v)
[1.0000, 2.0000, 3.0000, 4.0000]
sage: finance.TimeSeries(v[:,0])
@@ -2098,14 +2098,14 @@ cdef class TimeSeries:
sage: w[0] = 20
sage: w
- array([ 20. , -3. , 4.5, -2. ])
+ array([20. , -3. , 4.5, -2. ])
sage: v
[20.0000, -3.0000, 4.5000, -2.0000]
If you want a separate copy do not give the ``copy=False`` option. ::
sage: z = v.numpy(); z
- array([ 20. , -3. , 4.5, -2. ])
+ array([20. , -3. , 4.5, -2. ])
sage: z[0] = -10
sage: v
[20.0000, -3.0000, 4.5000, -2.0000]
diff --git a/src/sage/functions/hyperbolic.py b/src/sage/functions/hyperbolic.py
index 931a4b41e4..bf33fc483d 100644
--- a/src/sage/functions/hyperbolic.py
+++ b/src/sage/functions/hyperbolic.py
@@ -214,7 +214,7 @@ class Function_coth(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2, 5)
sage: coth(a)
- array([ 1.03731472, 1.00496982, 1.00067115])
+ array([1.03731472, 1.00496982, 1.00067115])
"""
return 1.0 / tanh(x)
@@ -267,7 +267,7 @@ class Function_sech(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2, 5)
sage: sech(a)
- array([ 0.26580223, 0.09932793, 0.03661899])
+ array([0.26580223, 0.09932793, 0.03661899])
"""
return 1.0 / cosh(x)
@@ -318,7 +318,7 @@ class Function_csch(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2, 5)
sage: csch(a)
- array([ 0.27572056, 0.09982157, 0.03664357])
+ array([0.27572056, 0.09982157, 0.03664357])
"""
return 1.0 / sinh(x)
@@ -586,7 +586,7 @@ class Function_arccoth(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2,5)
sage: acoth(a)
- array([ 0.54930614, 0.34657359, 0.25541281])
+ array([0.54930614, 0.34657359, 0.25541281])
"""
return arctanh(1.0 / x)
diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py
index 017c85a96f..33fbb499c5 100644
--- a/src/sage/functions/orthogonal_polys.py
+++ b/src/sage/functions/orthogonal_polys.py
@@ -810,12 +810,12 @@ class Func_chebyshev_T(ChebyshevFunction):
sage: z2 = numpy.array([[1,2],[1,2]])
sage: z3 = numpy.array([1,2,3.])
sage: chebyshev_T(1,z)
- array([ 1., 2.])
+ array([1., 2.])
sage: chebyshev_T(1,z2)
- array([[ 1., 2.],
- [ 1., 2.]])
+ array([[1., 2.],
+ [1., 2.]])
sage: chebyshev_T(1,z3)
- array([ 1., 2., 3.])
+ array([1., 2., 3.])
sage: chebyshev_T(z,0.1)
array([ 0.1 , -0.98])
"""
@@ -1095,12 +1095,12 @@ class Func_chebyshev_U(ChebyshevFunction):
sage: z2 = numpy.array([[1,2],[1,2]])
sage: z3 = numpy.array([1,2,3.])
sage: chebyshev_U(1,z)
- array([ 2., 4.])
+ array([2., 4.])
sage: chebyshev_U(1,z2)
- array([[ 2., 4.],
- [ 2., 4.]])
+ array([[2., 4.],
+ [2., 4.]])
sage: chebyshev_U(1,z3)
- array([ 2., 4., 6.])
+ array([2., 4., 6.])
sage: chebyshev_U(z,0.1)
array([ 0.2 , -0.96])
"""
diff --git a/src/sage/functions/other.py b/src/sage/functions/other.py
index 679384c907..d63b295a4c 100644
--- a/src/sage/functions/other.py
+++ b/src/sage/functions/other.py
@@ -390,7 +390,7 @@ class Function_ceil(BuiltinFunction):
sage: import numpy
sage: a = numpy.linspace(0,2,6)
sage: ceil(a)
- array([ 0., 1., 1., 2., 2., 2.])
+ array([0., 1., 1., 2., 2., 2.])
Test pickling::
@@ -539,7 +539,7 @@ class Function_floor(BuiltinFunction):
sage: import numpy
sage: a = numpy.linspace(0,2,6)
sage: floor(a)
- array([ 0., 0., 0., 1., 1., 2.])
+ array([0., 0., 0., 1., 1., 2.])
sage: floor(x)._sympy_()
floor(x)
@@ -840,7 +840,7 @@ def sqrt(x, *args, **kwds):
sage: import numpy
sage: a = numpy.arange(2,5)
sage: sqrt(a)
- array([ 1.41421356, 1.73205081, 2. ])
+ array([1.41421356, 1.73205081, 2. ])
"""
if isinstance(x, float):
return math.sqrt(x)
diff --git a/src/sage/functions/trig.py b/src/sage/functions/trig.py
index e7e7a311cd..e7ff78a9de 100644
--- a/src/sage/functions/trig.py
+++ b/src/sage/functions/trig.py
@@ -731,7 +731,7 @@ class Function_arccot(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2, 5)
sage: arccot(a)
- array([ 0.46364761, 0.32175055, 0.24497866])
+ array([0.46364761, 0.32175055, 0.24497866])
"""
return math.pi/2 - arctan(x)
@@ -787,7 +787,7 @@ class Function_arccsc(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2, 5)
sage: arccsc(a)
- array([ 0.52359878, 0.33983691, 0.25268026])
+ array([0.52359878, 0.33983691, 0.25268026])
"""
return arcsin(1.0/x)
@@ -845,7 +845,7 @@ class Function_arcsec(GinacFunction):
sage: import numpy
sage: a = numpy.arange(2, 5)
sage: arcsec(a)
- array([ 1.04719755, 1.23095942, 1.31811607])
+ array([1.04719755, 1.23095942, 1.31811607])
"""
return arccos(1.0/x)
@@ -920,13 +920,13 @@ class Function_arctan2(GinacFunction):
sage: a = numpy.linspace(1, 3, 3)
sage: b = numpy.linspace(3, 6, 3)
sage: atan2(a, b)
- array([ 0.32175055, 0.41822433, 0.46364761])
+ array([0.32175055, 0.41822433, 0.46364761])
sage: atan2(1,a)
- array([ 0.78539816, 0.46364761, 0.32175055])
+ array([0.78539816, 0.46364761, 0.32175055])
sage: atan2(a, 1)
- array([ 0.78539816, 1.10714872, 1.24904577])
+ array([0.78539816, 1.10714872, 1.24904577])
TESTS::
diff --git a/src/sage/matrix/constructor.pyx b/src/sage/matrix/constructor.pyx
index 19a1d37df0..5780dfae1c 100644
--- a/src/sage/matrix/constructor.pyx
+++ b/src/sage/matrix/constructor.pyx
@@ -494,8 +494,8 @@ class MatrixFactory(object):
[7 8 9]
Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
sage: n = matrix(QQ, 2, 2, [1, 1/2, 1/3, 1/4]).numpy(); n
- array([[ 1. , 0.5 ],
- [ 0.33333333, 0.25 ]])
+ array([[1. , 0.5 ],
+ [0.33333333, 0.25 ]])
sage: matrix(QQ, n)
[ 1 1/2]
[1/3 1/4]
diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx
index 48e0a8a97f..1be5d35b19 100644
--- a/src/sage/matrix/matrix_double_dense.pyx
+++ b/src/sage/matrix/matrix_double_dense.pyx
@@ -2546,7 +2546,7 @@ cdef class Matrix_double_dense(Matrix_dense):
sage: P.is_unitary(algorithm='orthonormal')
Traceback (most recent call last):
...
- ValueError: failed to create intent(cache|hide)|optional array-- must have defined dimensions but got (0,)
+ error: ((lwork==-1)||(lwork >= MAX(1,2*n))) failed for 3rd keyword lwork: zgees:lwork=0
TESTS::
@@ -3662,8 +3662,8 @@ cdef class Matrix_double_dense(Matrix_dense):
[0.0 1.0 2.0]
[3.0 4.0 5.0]
sage: m.numpy()
- array([[ 0., 1., 2.],
- [ 3., 4., 5.]])
+ array([[0., 1., 2.],
+ [3., 4., 5.]])
Alternatively, numpy automatically calls this function (via
the magic :meth:`__array__` method) to convert Sage matrices
@@ -3674,16 +3674,16 @@ cdef class Matrix_double_dense(Matrix_dense):
[0.0 1.0 2.0]
[3.0 4.0 5.0]
sage: numpy.array(m)
- array([[ 0., 1., 2.],
- [ 3., 4., 5.]])
+ array([[0., 1., 2.],
+ [3., 4., 5.]])
sage: numpy.array(m).dtype
dtype('float64')
sage: m = matrix(CDF, 2, range(6)); m
[0.0 1.0 2.0]
[3.0 4.0 5.0]
sage: numpy.array(m)
- array([[ 0.+0.j, 1.+0.j, 2.+0.j],
- [ 3.+0.j, 4.+0.j, 5.+0.j]])
+ array([[0.+0.j, 1.+0.j, 2.+0.j],
+ [3.+0.j, 4.+0.j, 5.+0.j]])
sage: numpy.array(m).dtype
dtype('complex128')
diff --git a/src/sage/matrix/special.py b/src/sage/matrix/special.py
index c698ba5e97..b743bab354 100644
--- a/src/sage/matrix/special.py
+++ b/src/sage/matrix/special.py
@@ -705,7 +705,7 @@ def diagonal_matrix(arg0=None, arg1=None, arg2=None, sparse=True):
sage: import numpy
sage: entries = numpy.array([1.2, 5.6]); entries
- array([ 1.2, 5.6])
+ array([1.2, 5.6])
sage: A = diagonal_matrix(3, entries); A
[1.2 0.0 0.0]
[0.0 5.6 0.0]
@@ -715,7 +715,7 @@ def diagonal_matrix(arg0=None, arg1=None, arg2=None, sparse=True):
sage: j = numpy.complex(0,1)
sage: entries = numpy.array([2.0+j, 8.1, 3.4+2.6*j]); entries
- array([ 2.0+1.j , 8.1+0.j , 3.4+2.6j])
+ array([2. +1.j , 8.1+0.j , 3.4+2.6j])
sage: A = diagonal_matrix(entries); A
[2.0 + 1.0*I 0.0 0.0]
[ 0.0 8.1 0.0]
diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
index 230f142117..2ab1c0ae68 100644
--- a/src/sage/modules/free_module_element.pyx
+++ b/src/sage/modules/free_module_element.pyx
@@ -982,7 +982,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
sage: v.numpy()
array([1, 2, 5/6], dtype=object)
sage: v.numpy(dtype=float)
- array([ 1. , 2. , 0.83333333])
+ array([1. , 2. , 0.83333333])
sage: v.numpy(dtype=int)
array([1, 2, 0])
sage: import numpy
@@ -993,7 +993,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
be more efficient but may have unintended consequences::
sage: v.numpy(dtype=None)
- array([ 1. , 2. , 0.83333333])
+ array([1. , 2. , 0.83333333])
sage: w = vector(ZZ, [0, 1, 2^63 -1]); w
(0, 1, 9223372036854775807)
diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx
index 39fc2970de..2badf98284 100644
--- a/src/sage/modules/vector_double_dense.pyx
+++ b/src/sage/modules/vector_double_dense.pyx
@@ -807,13 +807,13 @@ cdef class Vector_double_dense(FreeModuleElement):
sage: v = vector(CDF,4,range(4))
sage: v.numpy()
- array([ 0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])
+ array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])
sage: v = vector(CDF,0)
sage: v.numpy()
array([], dtype=complex128)
sage: v = vector(RDF,4,range(4))
sage: v.numpy()
- array([ 0., 1., 2., 3.])
+ array([0., 1., 2., 3.])
sage: v = vector(RDF,0)
sage: v.numpy()
array([], dtype=float64)
@@ -823,11 +823,11 @@ cdef class Vector_double_dense(FreeModuleElement):
sage: import numpy
sage: v = vector(CDF, 3, range(3))
sage: v.numpy()
- array([ 0.+0.j, 1.+0.j, 2.+0.j])
+ array([0.+0.j, 1.+0.j, 2.+0.j])
sage: v.numpy(dtype=numpy.float64)
- array([ 0., 1., 2.])
+ array([0., 1., 2.])
sage: v.numpy(dtype=numpy.float32)
- array([ 0., 1., 2.], dtype=float32)
+ array([0., 1., 2.], dtype=float32)
"""
if dtype is None or dtype is self._vector_numpy.dtype:
from copy import copy
diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
index 17b5ebb84b..92ce35c502 100644
--- a/src/sage/numerical/optimize.py
+++ b/src/sage/numerical/optimize.py
@@ -486,9 +486,9 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args)
else:
min = optimize.fmin_tnc(f, x0, approx_grad=True, bounds=cons, messages=0, **args)[0]
elif isinstance(cons[0], function_type) or isinstance(cons[0], Expression):
- min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
+ min = optimize.fmin_cobyla(f, x0, cons, disp=0, **args)
elif isinstance(cons, function_type) or isinstance(cons, Expression):
- min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
+ min = optimize.fmin_cobyla(f, x0, cons, disp=0, **args)
return vector(RDF, min)
diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
index ad9693da62..758fb709b7 100644
--- a/src/sage/plot/complex_plot.pyx
+++ b/src/sage/plot/complex_plot.pyx
@@ -61,9 +61,9 @@ cdef inline double mag_to_lightness(double r):
sage: from sage.plot.complex_plot import complex_to_rgb
sage: complex_to_rgb([[0, 1, 10]])
- array([[[ 0. , 0. , 0. ],
- [ 0.77172568, 0. , 0. ],
- [ 1. , 0.22134776, 0.22134776]]])
+ array([[[0. , 0. , 0. ],
+ [0.77172568, 0. , 0. ],
+ [1. , 0.22134776, 0.22134776]]])
"""
return atan(log(sqrt(r)+1)) * (4/PI) - 1
@@ -82,13 +82,13 @@ def complex_to_rgb(z_values):
sage: from sage.plot.complex_plot import complex_to_rgb
sage: complex_to_rgb([[0, 1, 1000]])
- array([[[ 0. , 0. , 0. ],
- [ 0.77172568, 0. , 0. ],
- [ 1. , 0.64421177, 0.64421177]]])
+ array([[[0. , 0. , 0. ],
+ [0.77172568, 0. , 0. ],
+ [1. , 0.64421177, 0.64421177]]])
sage: complex_to_rgb([[0, 1j, 1000j]])
- array([[[ 0. , 0. , 0. ],
- [ 0.38586284, 0.77172568, 0. ],
- [ 0.82210588, 1. , 0.64421177]]])
+ array([[[0. , 0. , 0. ],
+ [0.38586284, 0.77172568, 0. ],
+ [0.82210588, 1. , 0.64421177]]])
"""
import numpy
cdef unsigned int i, j, imax, jmax
diff --git a/src/sage/plot/line.py b/src/sage/plot/line.py
index 23f5e61446..3b1b51d7cf 100644
--- a/src/sage/plot/line.py
+++ b/src/sage/plot/line.py
@@ -502,14 +502,12 @@ def line2d(points, **options):
from sage.plot.all import Graphics
from sage.plot.plot import xydata_from_point_list
from sage.rings.all import CC, CDF
+ points = list(points) # make sure points is a python list
if points in CC or points in CDF:
pass
else:
- try:
- if not points:
- return Graphics()
- except ValueError: # numpy raises a ValueError if not empty
- pass
+ if len(points) == 0:
+ return Graphics()
xdata, ydata = xydata_from_point_list(points)
g = Graphics()
g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
diff --git a/src/sage/plot/plot_field.py b/src/sage/plot/plot_field.py
index 0025098a8d..23c80902f3 100644
--- a/src/sage/plot/plot_field.py
+++ b/src/sage/plot/plot_field.py
@@ -49,9 +49,10 @@ class PlotField(GraphicPrimitive):
sage: r.xpos_array
[0.0, 0.0, 1.0, 1.0]
sage: r.yvec_array
- masked_array(data = [0.0 0.70710678118... 0.70710678118... 0.89442719...],
- mask = [False False False False],
- fill_value = 1e+20)
+ masked_array(data=[0.0, 0.70710678118..., 0.70710678118...,
+ 0.89442719...],
+ mask=[False, False, False, False],
+ fill_value=1e+20)
TESTS:
diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py
index f3da57c370..3806f4b32f 100644
--- a/src/sage/plot/streamline_plot.py
+++ b/src/sage/plot/streamline_plot.py
@@ -38,16 +38,14 @@ class StreamlinePlot(GraphicPrimitive):
sage: r.options()['plot_points']
2
sage: r.xpos_array
- array([ 0., 1.])
+ array([0., 1.])
sage: r.yvec_array
- masked_array(data =
- [[1.0 1.0]
- [0.5403023058681398 0.5403023058681398]],
- mask =
- [[False False]
- [False False]],
- fill_value = 1e+20)
- <BLANKLINE>
+ masked_array(
+ data=[[1.0, 1.0],
+ [0.5403023058681398, 0.5403023058681398]],
+ mask=[[False, False],
+ [False, False]],
+ fill_value=1e+20)
TESTS:
diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx
index f66cd898b9..35995886d5 100644
--- a/src/sage/probability/probability_distribution.pyx
+++ b/src/sage/probability/probability_distribution.pyx
@@ -130,7 +130,17 @@ cdef class ProbabilityDistribution:
0.0,
1.4650000000000003]
sage: b
- [0.0, 0.20000000000000001, 0.40000000000000002, 0.60000000000000009, 0.80000000000000004, 1.0, 1.2000000000000002, 1.4000000000000001, 1.6000000000000001, 1.8, 2.0]
+ [0.0,
+ 0.2,
+ 0.4,
+ 0.6000000000000001,
+ 0.8,
+ 1.0,
+ 1.2000000000000002,
+ 1.4000000000000001,
+ 1.6,
+ 1.8,
+ 2.0]
"""
import pylab
l = [float(self.get_random_element()) for _ in range(num_samples)]
diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx
index a0bfe080f5..7d95e7a1a8 100644
--- a/src/sage/rings/rational.pyx
+++ b/src/sage/rings/rational.pyx
@@ -1056,7 +1056,7 @@ cdef class Rational(sage.structure.element.FieldElement):
dtype('O')
sage: numpy.array([1, 1/2, 3/4])
- array([ 1. , 0.5 , 0.75])
+ array([1. , 0.5 , 0.75])
"""
if mpz_cmp_ui(mpq_denref(self.value), 1) == 0:
if mpz_fits_slong_p(mpq_numref(self.value)):
diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx
index 4c630867a4..64e2187f5b 100644
--- a/src/sage/rings/real_mpfr.pyx
+++ b/src/sage/rings/real_mpfr.pyx
@@ -1438,7 +1438,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
sage: import numpy
sage: numpy.arange(10.0)
- array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
+ array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
sage: numpy.array([1.0, 1.1, 1.2]).dtype
dtype('float64')
sage: numpy.array([1.000000000000000000000000000000000000]).dtype
diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py
index 3d270ebf9d..1144f168e3 100644
--- a/src/sage/schemes/elliptic_curves/height.py
+++ b/src/sage/schemes/elliptic_curves/height.py
@@ -1623,18 +1623,18 @@ class EllipticCurveCanonicalHeight:
even::
sage: H.wp_on_grid(v,4)
- array([[ 25.43920182, 5.28760943, 5.28760943, 25.43920182],
- [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
- [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
- [ 25.43920182, 5.28760943, 5.28760943, 25.43920182]])
+ array([[25.43920182, 5.28760943, 5.28760943, 25.43920182],
+ [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
+ [ 6.05099485, 1.83757786, 1.83757786, 6.05099485],
+ [25.43920182, 5.28760943, 5.28760943, 25.43920182]])
The array of values on the half-grid::
sage: H.wp_on_grid(v,4,True)
- array([[ 25.43920182, 5.28760943],
- [ 6.05099485, 1.83757786],
- [ 6.05099485, 1.83757786],
- [ 25.43920182, 5.28760943]])
+ array([[25.43920182, 5.28760943],
+ [ 6.05099485, 1.83757786],
+ [ 6.05099485, 1.83757786],
+ [25.43920182, 5.28760943]])
"""
tau = self.tau(v)
fk, err = self.fk_intervals(v, 15, CDF)
diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx
index 2dcb0492b9..2b1a06385c 100644
--- a/src/sage/symbolic/ring.pyx
+++ b/src/sage/symbolic/ring.pyx
@@ -1135,7 +1135,7 @@ cdef class NumpyToSRMorphism(Morphism):
sage: cos(numpy.int('2'))
cos(2)
sage: numpy.cos(numpy.int('2'))
- -0.41614683654714241
+ -0.4161468365471424
"""
cdef _intermediate_ring

View File

@ -0,0 +1,20 @@
diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py
index 6bdc9a0..31fc780 100644
--- a/src/sage/doctest/parsing.py
+++ b/src/sage/doctest/parsing.py
@@ -40,6 +40,7 @@ from .external import available_software
float_regex = re.compile('\s*([+-]?\s*((\d*\.?\d+)|(\d+\.?))([eE][+-]?\d+)?)')
optional_regex = re.compile(r'(py2|py3|long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w)*))')
+pari_stack_warning_regex = re.compile(r'\s*\*\*\*.*(Warning: increasing stack size to )\d+\.')
find_sage_prompt = re.compile(r"^(\s*)sage: ", re.M)
find_sage_continuation = re.compile(r"^(\s*)\.\.\.\.:", re.M)
random_marker = re.compile('.*random', re.I)
@@ -935,6 +936,7 @@ class SageOutputChecker(doctest.OutputChecker):
<type 'float'>
"""
got = self.human_readable_escape_sequences(got)
+ got = pari_stack_warning_regex.sub('', got)
if isinstance(want, MarkedOutput):
if want.random:
return True

View File

@ -0,0 +1,479 @@
diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py
index 3a417d9d5c..fadaadbaf6 100644
--- a/src/sage/calculus/calculus.py
+++ b/src/sage/calculus/calculus.py
@@ -231,7 +231,7 @@ Another example::
sage: f(x=3)
arcsinh(1)
sage: f.derivative(x)
- 1/3/sqrt(1/9*x^2 + 1)
+ 1/sqrt(x^2 + 9)
We compute the length of the parabola from 0 to 2::
@@ -1509,8 +1509,8 @@ def laplace(ex, t, s, algorithm='maxima'):
Testing SymPy::
sage: laplace(t^n, t, s, algorithm='sympy')
- (s^(-n)*gamma(n + 1)/s, 0, -re(n) < 1)
-
+ (gamma(n + 1)/(s*s^n), 0, -re(n) < 1)
+
Testing Maxima::
sage: laplace(t^n, t, s, algorithm='maxima')
diff --git a/src/sage/functions/hypergeometric.py b/src/sage/functions/hypergeometric.py
index 1fc2db5c94..f3e49b9cdb 100644
--- a/src/sage/functions/hypergeometric.py
+++ b/src/sage/functions/hypergeometric.py
@@ -34,7 +34,7 @@ Simplification (note that ``simplify_full`` does not yet call
sage: a.simplify_hypergeometric()
1/((-e^x + 1)^e^x)
sage: a.simplify_hypergeometric(algorithm='sage')
- (-e^x + 1)^(-e^x)
+ 1/((-e^x + 1)^e^x)
Equality testing::
@@ -145,7 +145,7 @@ Series expansions of confluent hypergeometric functions::
sage: hypergeometric_M(2, 2, x).series(x, 3)
1 + 1*x + 1/2*x^2 + Order(x^3)
- sage: hypergeometric_U(2, 2, x).series(x == 3, 100).subs(x=1).n()
+ sage: hypergeometric_U(2, 2, x).series(x == 3, 100).subs(x=1).n() # known bug (see :trac:`25688`)
0.403652637676806
sage: hypergeometric_U(2, 2, 1).n()
0.403652637676806
@@ -773,7 +773,7 @@ def closed_form(hyp):
sage: closed_form(hypergeometric([], [], z))
e^z
sage: closed_form(hypergeometric([a], [], z))
- (-z + 1)^(-a)
+ 1/((-z + 1)^a)
sage: closed_form(hypergeometric([1, 1, 2], [1, 1], z))
(z - 1)^(-2)
sage: closed_form(hypergeometric([2, 3], [1], x))
@@ -1121,7 +1121,7 @@ class Hypergeometric_U(BuiltinFunction):
sage: var('a b z')
(a, b, z)
sage: hypergeometric_U(a, b, z).generalized()
- z^(-a)*hypergeometric((a, a - b + 1), (), -1/z)
+ hypergeometric((a, a - b + 1), (), -1/z)/z^a
sage: hypergeometric_U(1, 3, 1/2).generalized()
2*hypergeometric((1, -1), (), -2)
sage: hypergeometric_U(3, I, 2).generalized()
diff --git a/src/sage/functions/log.py b/src/sage/functions/log.py
index 75d1bf8060..61968582af 100644
--- a/src/sage/functions/log.py
+++ b/src/sage/functions/log.py
@@ -518,17 +518,17 @@ class Function_polylog(GinacFunction):
sage: BF = RealBallField(100)
sage: polylog(2, BF(1/3))
- [0.36621322997706348761674629766 +/- 4.51e-30]
+ [0.36621322997706348761674629766... +/- ...]
sage: polylog(2, BF(4/3))
- nan
+ [2.27001825336107090380391448586 +/- 5.64e-30] + [-0.90377988538400159956755721265 +/- 8.39e-30]*I
sage: parent(_)
- Real ball field with 100 bits of precision
+ Complex ball field with 100 bits of precision
sage: polylog(2, CBF(1/3))
- [0.366213229977063 +/- 5.85e-16]
+ [0.366213229977063 +/- ...]
sage: parent(_)
Complex ball field with 53 bits of precision
sage: polylog(2, CBF(1))
- [1.644934066848226 +/- 6.59e-16]
+ [1.644934066848226 +/- ...]
sage: parent(_)
Complex ball field with 53 bits of precision
"""
diff --git a/src/sage/functions/trig.py b/src/sage/functions/trig.py
index e7e7a311cd..1f2926d6c9 100644
--- a/src/sage/functions/trig.py
+++ b/src/sage/functions/trig.py
@@ -529,13 +529,8 @@ class Function_arcsin(GinacFunction):
arcsin
sage: asin(complex(1,1))
(0.6662394324925152+1.0612750619050357j)
-
- Check that :trac:`22823` is fixed::
-
- sage: bool(asin(SR(2.1)) == NaN)
- True
- sage: asin(SR(2.1)).is_real()
- False
+ sage: asin(SR(2.1))
+ 1.57079632679490 - 1.37285914424258*I
"""
GinacFunction.__init__(self, 'arcsin', latex_name=r"\arcsin",
conversions=dict(maxima='asin', sympy='asin', fricas="asin", giac="asin"))
@@ -595,13 +590,8 @@ class Function_arccos(GinacFunction):
arccos
sage: acos(complex(1,1))
(0.9045568943023814-1.0612750619050357j)
-
- Check that :trac:`22823` is fixed::
-
- sage: bool(acos(SR(2.1)) == NaN)
- True
- sage: acos(SR(2.1)).is_real()
- False
+ sage: acos(SR(2.1))
+ 1.37285914424258*I
"""
GinacFunction.__init__(self, 'arccos', latex_name=r"\arccos",
conversions=dict(maxima='acos', sympy='acos', fricas='acos', giac='acos'))
@@ -807,7 +797,7 @@ class Function_arcsec(GinacFunction):
sage: arcsec(2).n(100)
1.0471975511965977461542144611
sage: arcsec(1/2).n(100)
- NaN
+ 1.3169578969248167086250463473*I
sage: RDF(arcsec(2)) # abs tol 1e-15
1.0471975511965976
sage: arcsec(1 + I)
@@ -958,7 +948,9 @@ class Function_arctan2(GinacFunction):
sage: atan2(0,0,hold=True)
arctan2(0, 0)
sage: atan2(0,0,hold=True).n()
- NaN
+ Traceback (most recent call last):
+ ...
+ RuntimeError: atan2(): division by zero
Check if :trac:`10062` is fixed, this was caused by
``(I*I).is_positive()`` returning ``True``::
diff --git a/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py b/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
index 3b5c8d1729..1c6b73a16c 100644
--- a/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
+++ b/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
@@ -1422,8 +1422,10 @@ class HyperbolicGeodesicUHP(HyperbolicGeodesic):
expressions do not generate runtime errors. ::
sage: g=HyperbolicPlane().UHP().get_geodesic(-1+I,1+I)
- sage: g.midpoint()
- 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)
+ sage: point = g.midpoint(); point
+ Point in UHP -1/2*(sqrt(2)*...
+ sage: QQbar(point.coordinates()).radical_expression()
+ I*sqrt(2)
Check that floating points remain floating points
in :meth:`midpoint` ::
diff --git a/src/sage/interfaces/fricas.py b/src/sage/interfaces/fricas.py
index 82aae78e37..8501ea2a18 100644
--- a/src/sage/interfaces/fricas.py
+++ b/src/sage/interfaces/fricas.py
@@ -1084,14 +1084,14 @@ class FriCASElement(ExpectElement):
0.451026811796262,
0.732815101786507,
0.837981225008390,
- NaN,
- NaN,
+ 1.57079632679490 - 0.467145308103262*I,
+ 0.467145308103262*I,
1.11976951499863,
0.451026811796262,
0.732815101786507,
0.837981225008390,
- NaN,
- NaN]
+ 1.57079632679490 - 0.467145308103262*I,
+ 0.467145308103262*I]
sage: l = [tanh, sinh, cosh, coth, sech, csch, asinh, acosh, atanh, acoth, asech, acsch, arcsinh, arccosh, arctanh, arccoth, arcsech, arccsch]
sage: [f(x)._fricas_().sage().subs(x=0.9) for f in l] # optional - fricas
[0.716297870199024,
diff --git a/src/sage/libs/pynac/pynac.pyx b/src/sage/libs/pynac/pynac.pyx
index 9e9d8f664b..e3406f007e 100644
--- a/src/sage/libs/pynac/pynac.pyx
+++ b/src/sage/libs/pynac/pynac.pyx
@@ -1824,7 +1824,7 @@ cdef py_atan2(x, y):
sage: atan2(CC(I), CC(I+1))
0.553574358897045 + 0.402359478108525*I
sage: atan2(CBF(I), CBF(I+1))
- [0.55357435889705 +/- 5.58e-15] + [0.402359478108525 +/- 7.11e-16]*I
+ [0.55357435889705 +/- ...] + [0.402359478108525 +/- ...]*I
Check that :trac:`23776` is fixed and RDF input gives real output::
diff --git a/src/sage/matrix/matrix_symbolic_dense.pyx b/src/sage/matrix/matrix_symbolic_dense.pyx
index 46a15e53eb..7a0beb437b 100644
--- a/src/sage/matrix/matrix_symbolic_dense.pyx
+++ b/src/sage/matrix/matrix_symbolic_dense.pyx
@@ -200,7 +200,7 @@ cdef class Matrix_symbolic_dense(Matrix_generic_dense):
sage: eval, [evec], mult = es[0]
sage: delta = eval*evec - evec*A
sage: abs(abs(delta)) < 1e-10
- 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)
+ 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)
sage: abs(abs(delta)).n() < 1e-10
True
diff --git a/src/sage/modules/matrix_morphism.py b/src/sage/modules/matrix_morphism.py
index 17a1d6e290..03892ceec0 100644
--- a/src/sage/modules/matrix_morphism.py
+++ b/src/sage/modules/matrix_morphism.py
@@ -214,9 +214,9 @@ class MatrixMorphism_abstract(sage.categories.morphism.Morphism):
sage: f((1, 0))
Traceback (most recent call last):
...
- TypeError: Unable to coerce entries (=[1.00000000000000*I, 0.000000000000000]) to coefficients in Real Field with 53 bits of precision
+ TypeError: Unable to coerce entries (=[1.00000000000000*I, 0]) to coefficients in Real Field with 53 bits of precision
sage: f((1, 0), coerce=False)
- (1.00000000000000*I, 0.000000000000000)
+ (1.00000000000000*I, 0)
"""
if self.domain().is_ambient():
diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
index 77cdeb8c46..e501e74036 100644
--- a/src/sage/plot/plot.py
+++ b/src/sage/plot/plot.py
@@ -2061,7 +2061,7 @@ def _plot(funcs, xrange, parametric=False,
plot properly (:trac:`13246`)::
sage: parametric_plot((x, arcsec(x)), (x, -2, 2))
- Graphics object consisting of 1 graphics primitive
+ Graphics object consisting of 2 graphics primitives
"""
from sage.plot.colors import Color
diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py
index 8ce2e839d7..948207c95e 100644
--- a/src/sage/repl/display/formatter.py
+++ b/src/sage/repl/display/formatter.py
@@ -25,11 +25,11 @@ generally, all sage expression as an ASCII art object::
sage: shell = get_test_shell()
sage: shell.run_cell('%display ascii_art')
sage: shell.run_cell('integral(x^2/pi^x, x)')
- / 2 2 \ -x*log(pi)
- -\x *log (pi) + 2*x*log(pi) + 2/*e
- ---------------------------------------------
- 3
- log (pi)
+ -x / 2 2 \
+ -pi *\x *log (pi) + 2*x*log(pi) + 2/
+ --------------------------------------
+ 3
+ log (pi)
sage: shell.run_cell("i = var('i')")
sage: shell.run_cell('sum(i*x^i, i, 0, 10)')
10 9 8 7 6 5 4 3 2
diff --git a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
index d8ebbf4f76..8c60f65e99 100644
--- a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
+++ b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
@@ -151,8 +151,8 @@ A multiple point example (Example 6.5 of [RaWi2012]_)::
[(x + 2*y - 1, 1), (2*x + y - 1, 1)])
sage: F1 = decomp[1]
sage: F1.asymptotics(p, alpha, 2)
- (-3*((2*a^2 - 5*a*b + 2*b^2)*r^2 + (a + b)*r + 3)*((1/3)^(-a)*(1/3)^(-b))^r,
- (1/3)^(-a)*(1/3)^(-b), -3*(2*a^2 - 5*a*b + 2*b^2)*r^2 - 3*(a + b)*r - 9)
+ (-3*((2*a^2 - 5*a*b + 2*b^2)*r^2 + (a + b)*r + 3)*(1/((1/3)^a*(1/3)^b))^r,
+ 1/((1/3)^a*(1/3)^b), -3*(2*a^2 - 5*a*b + 2*b^2)*r^2 - 3*(a + b)*r - 9)
sage: alpha = [4, 3]
sage: decomp = F.asymptotic_decomposition(alpha)
sage: F1 = decomp[1]
@@ -2159,7 +2159,7 @@ class FractionWithFactoredDenominator(RingElement):
sage: p = {x: 1/3, y: 1/3}
sage: alpha = (var('a'), var('b'))
sage: F.asymptotics_multiple(p, alpha, 2, var('r')) # long time
- (3*((1/3)^(-a)*(1/3)^(-b))^r*e^(2/3), (1/3)^(-a)*(1/3)^(-b), 3*e^(2/3))
+ (3*(1/((1/3)^a*(1/3)^b))^r*e^(2/3), 1/((1/3)^a*(1/3)^b), 3*e^(2/3))
"""
from itertools import product
from sage.calculus.functions import jacobian
diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py
index 16a268a02c..5fd244e93b 100644
--- a/src/sage/stats/basic_stats.py
+++ b/src/sage/stats/basic_stats.py
@@ -183,7 +183,7 @@ def std(v, bias=False):
sage: std([])
NaN
sage: std([I, sqrt(2), 3/5])
- 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)
+ 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)
sage: std([RIF(1.0103, 1.0103), RIF(2)])
0.6998235813403261?
sage: import numpy
diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
index ab4c05de3a..60f0dc549a 100644
--- a/src/sage/symbolic/expression.pyx
+++ b/src/sage/symbolic/expression.pyx
@@ -622,7 +622,7 @@ cdef class Expression(CommutativeRingElement):
sage: x^(-5)
x^(-5)
sage: x^(-y)
- x^(-y)
+ 1/(x^y)
sage: 2*x^(-1)
2/x
sage: i*x
@@ -3621,14 +3621,14 @@ cdef class Expression(CommutativeRingElement):
sage: repl_dict = {b_0: b_0, b_3: b_1, b_2: b_3, b_1: b_2}
sage: P = precomp.substitute(repl_dict)
sage: P.expand()
- -2^(-b_0)*2^(-b_2)*2^b_3 - 2^b_0*2^(-b_2)*2^b_3 -
- 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)
- - 2*2^b_0*2^(-b_2) - 2*2^(-b_0)*2^b_2 + 2*2^b_0*2^b_2 +
- 2^(-b_0)*2^b_3 + 2^b_0*2^b_3 + 2^(-b_2)*2^b_3 + 2^b_2*2^b_3 +
- 2*2^(-b_0) + 2*2^b_0 + 2*2^(-b_2) + 2*2^b_2 - 9*2^b_3 -
- 2^(-b_0)*2^(-b_2)/2^b_3 - 2^b_0*2^(-b_2)/2^b_3 -
- 2^(-b_0)*2^b_2/2^b_3 + 2^b_0*2^b_2/2^b_3 + 2^(-b_0)/2^b_3 +
- 2^b_0/2^b_3 + 2^(-b_2)/2^b_3 + 2^b_2/2^b_3 - 9/2^b_3 - 18
+ 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 +
+ 2*2^b_0 + 2*2^b_2 - 9*2^b_3 + 2^b_0*2^b_2/2^b_3 -
+ 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 -
+ 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 +
+ 2^b_3/2^b_2 + 2/2^b_0 + 2/2^b_2 - 2^b_0/(2^b_2*2^b_3) -
+ 2^b_2/(2^b_0*2^b_3) - 9/2^b_3 - 2^b_3/(2^b_0*2^b_2) -
+ 2/(2^b_0*2^b_2) + 1/(2^b_0*2^b_3) + 1/(2^b_2*2^b_3) -
+ 1/(2^b_0*2^b_2*2^b_3) - 18
sage: _0,b_1,b_2=var('b_0,b_1,b_2')
sage: f = 1/27*b_2^2/(2^b_2)^2 + 1/27*b_1^2/(2^b_1)^2 + \
@@ -3809,7 +3809,7 @@ cdef class Expression(CommutativeRingElement):
sage: x = SR.symbol('x', domain='real')
sage: (x^3)^(1/3)
- (x^3)^(1/3)
+ x
sage: (x^4)^(1/4)
abs(x)
sage: (x^8)^(1/4)
@@ -3872,7 +3872,7 @@ cdef class Expression(CommutativeRingElement):
sage: 2^(x/log(2))
e^x
sage: 2^(-x^2/2/log(2))
- e^(-1/2*x^2)
+ 1/e^(1/2*x^2)
sage: x^(x/log(x))
x^(x/log(x))
sage: assume(x > 0)
@@ -4816,18 +4816,24 @@ cdef class Expression(CommutativeRingElement):
sage: ((x+y)^(x+y)).match(w0^w0)
{$0: x + y}
sage: t = ((a+b)*(a+c)).match((a+w0)*(a+w1))
- sage: t[w0], t[w1]
- (c, b)
+ sage: set([t[w0], t[w1]]) == set([b, c])
+ True
sage: ((a+b)*(a+c)).match((w0+b)*(w0+c))
{$0: a}
sage: t = ((a+b)*(a+c)).match((w0+w1)*(w0+w2))
- sage: t[w0], t[w1], t[w2]
- (a, c, b)
- sage: print(((a+b)*(a+c)).match((w0+w1)*(w1+w2)))
- None
+ sage: t[w0]
+ a
+ sage: set([t[w1], t[w2]]) == set([b, c])
+ True
+ sage: t = ((a+b)*(a+c)).match((w0+w1)*(w1+w2))
+ sage: t[w1]
+ a
+ sage: set([t[w0], t[w2]]) == set([b, c])
+ True
sage: t = (a*(x+y)+a*z+b).match(a*w0+w1)
- sage: t[w0], t[w1]
- (x + y, a*z + b)
+ sage: s = set([t[w0], t[w1]])
+ sage: s == set([x+y, a*z+b]) or s == set([z, a*(x+y)+b])
+ True
sage: print((a+b+c+d+f+g).match(c))
None
sage: (a+b+c+d+f+g).has(c)
@@ -4836,7 +4842,7 @@ cdef class Expression(CommutativeRingElement):
{$0: a + b + d + f + g}
sage: (a+b+c+d+f+g).match(c+g+w0)
{$0: a + b + d + f}
- sage: (a+b).match(a+b+w0)
+ sage: (a+b).match(a+b+w0) # known bug
{$0: 0}
sage: print((a*b^2).match(a^w0*b^w1))
None
@@ -5009,7 +5015,7 @@ cdef class Expression(CommutativeRingElement):
a^3 + b^3 + (x + y)^3
sage: t.subs(w0 == w0^2)
- (x^2 + y^2)^18 + a^16 + b^16
+ a^8 + b^8 + (x^2 + y^2)^6
sage: t.subs(a == b, b == c)
(x + y)^3 + b^2 + c^2
@@ -8392,9 +8398,13 @@ cdef class Expression(CommutativeRingElement):
sage: SR(I).arctan2(1)
arctan2(I, 1)
sage: SR(CDF(0,1)).arctan2(1)
- NaN + +infinity*I
- sage: SR(1).arctan2(CDF(0,1)) # known bug
- 0.7853981633974484 - 19.012501686914433*I
+ Traceback (most recent call last):
+ ...
+ ValueError: power::eval(): division by zero
+ sage: SR(1).arctan2(CDF(0,1))
+ Traceback (most recent call last):
+ ...
+ ValueError: power::eval(): division by zero
sage: arctan2(0,oo)
0
@@ -8656,7 +8666,7 @@ cdef class Expression(CommutativeRingElement):
1/2*I*pi
sage: SR(1/2).arccosh()
arccosh(1/2)
- sage: SR(CDF(1/2)).arccosh() # rel tol 1e-15
+ sage: SR(CDF(1/2)).arccosh() # rel tol 1e-15
1.0471975511965976*I
sage: maxima('acosh(0.5)')
1.04719755119659...*%i
@@ -11687,7 +11697,7 @@ cdef class Expression(CommutativeRingElement):
sage: a.solve(t)
[]
sage: b = a.canonicalize_radical(); b
- -23040.0*(-2.0*e^(1800*t) + 25.0*e^(900*t) - 32.0)*e^(-2400*t)
+ (46080.0*e^(1800*t) - 576000.0*e^(900*t) + 737280.0)*e^(-2400*t)
sage: b.solve(t)
[]
sage: b.solve(t, to_poly_solve=True)
@@ -12163,14 +12173,14 @@ cdef class Expression(CommutativeRingElement):
sage: (n,k,j)=var('n,k,j')
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
- -(-1)^(-j)*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
+ -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
sage: assume(j>-1)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
1
sage: forget()
sage: assume(n>=j)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
- -(-1)^(-j)*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
+ -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
sage: forget()
sage: assume(j==-1)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
@@ -12178,7 +12188,7 @@ cdef class Expression(CommutativeRingElement):
sage: forget()
sage: assume(j<-1)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
- -(-1)^(-j)*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
+ -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
sage: forget()
Check that :trac:`16176` is fixed::
diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
index da6f0eef42..4bd65ef572 100644
--- a/src/sage/symbolic/relation.py
+++ b/src/sage/symbolic/relation.py
@@ -895,7 +895,7 @@ def solve(f, *args, **kwds):
sage: (r[0][x], r[0][y])
(2*lambert_w(1/2), 1)
sage: solve(-2*x**3 + 4*x**2 - 2*x + 6 > 0, x, algorithm='sympy')
- [x < (1/6*sqrt(77) + 79/54)^(1/3) + 1/9/(1/6*sqrt(77) + 79/54)^(1/3) + 2/3]
+ [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]
sage: solve(sqrt(2*x^2 - 7) - (3 - x),x,algorithm='sympy')
[x == -8, x == 2]
sage: solve(sqrt(2*x + 9) - sqrt(x + 1) - sqrt(x + 4),x,algorithm='sympy')

View File

@ -0,0 +1,28 @@
diff --git a/src/sage/all.py b/src/sage/all.py
index ca309ef..be3186b 100644
--- a/src/sage/all.py
+++ b/src/sage/all.py
@@ -298,6 +298,23 @@ warnings.filterwarnings('ignore', module='matplotlib[.]font_manager')
warnings.filterwarnings('default',
'[\s\S]*See http://trac.sagemath.org/[0-9]* for details.')
+# Hotpatch around https://bugs.python.org/issue5755 which won't be fixed for
+# python 2.7. Idea by https://stackoverflow.com/a/36293331.
+from distutils.command.build_ext import build_ext
+from distutils.sysconfig import customize_compiler
+
+_build_extensions = build_ext.build_extensions
+
+def build_extensions_patched(self):
+ customize_compiler(self.compiler)
+ try:
+ self.compiler.compiler_so.remove("-Wstrict-prototypes")
+ except (AttributeError, ValueError):
+ pass
+ _build_extensions(self)
+
+build_ext.build_extensions = build_extensions_patched
+
# Set a new random number seed as the very last thing
# (so that printing initial_seed() and using that seed

View File

@ -0,0 +1,40 @@
diff --git a/src/sage/tests/py3_syntax.py b/src/sage/tests/py3_syntax.py
index e564860b48..86ab3725f9 100644
--- a/src/sage/tests/py3_syntax.py
+++ b/src/sage/tests/py3_syntax.py
@@ -179,15 +179,30 @@ class Python3SyntaxTest(SortedDirectoryWalkerABC):
sage: py3_syntax = Python3SyntaxTest()
sage: py3_syntax.test(src.name)
Invalid Python 3 syntax found:
- File "...py", line 1
- print "invalid print statement"
- ^
- SyntaxError: Missing parentheses in call to 'print'
+ Missing parentheses in call to 'print'...
sage: os.unlink(src.name)
"""
+
+ # compile all given files in memory, printing all errors
+ # inspired by the py_compile module (but without writing to file)
+ script = """
+import sys
+import importlib.machinery
+rv = 0
+for file in sys.argv[1:]:
+ loader = importlib.machinery.SourceFileLoader('<sage_test>', file)
+ source_bytes = loader.get_data(file)
+ try:
+ code = loader.source_to_code(source_bytes, file)
+ except Exception as err:
+ print(err)
+ rv = 1
+sys.exit(rv)
+"""
cmd = [
'python3',
- '-m', 'py_compile'
+ '-c',
+ script,
] + list(filenames)
process = subprocess.Popen(
cmd,

View File

@ -0,0 +1,14 @@
reverted:
--- b/src/sage/geometry/polyhedron/backend_cdd.py
+++ a/src/sage/geometry/polyhedron/backend_cdd.py
@@ -154,7 +154,9 @@
... [0.62, -1.38, 0.38],[0.144, -1.04, 0.04],
... [0.1309090909, -1.0290909091, 0.04]]
sage: Polyhedron(point_list)
+ Traceback (most recent call last):
+ ...
+ ValueError: *Error: Numerical inconsistency is found. Use the GMP exact arithmetic.
- A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 14 vertices
sage: Polyhedron(point_list, base_ring=QQ)
A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 14 vertices
"""

View File

@ -0,0 +1,31 @@
From 7419e0246230594ebfd5e7a2fe6b80d67abfc98a Mon Sep 17 00:00:00 2001
From: Jeroen Demeyer <jdemeyer@cage.ugent.be>
Date: Tue, 20 Mar 2018 10:40:41 +0100
Subject: Fix sphinxify doctests
---
sagenb/misc/sphinxify.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sagenb/misc/sphinxify.py b/sagenb/misc/sphinxify.py
index 4f76d41..15623d9 100644
--- a/sagenb/misc/sphinxify.py
+++ b/sagenb/misc/sphinxify.py
@@ -47,11 +47,11 @@ def sphinxify(docstring, format='html'):
sage: from sage.misc.sphinxify import sphinxify
sage: sphinxify('A test')
- '...<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
+ '<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
sage: sphinxify('**Testing**\n`monospace`')
- '...<div class="docstring"...<strong>Testing</strong>\n<span class="math"...</p>\n\n\n</div>'
+ '<div class="docstring"...<strong>Testing</strong>\n<span class="math notranslate"...</p>\n\n\n</div>'
sage: sphinxify('`x=y`')
- '...<div class="docstring">\n \n <p><span class="math">x=y</span></p>\n\n\n</div>'
+ '<div class="docstring">\n \n <p><span class="math notranslate">x=y</span></p>\n\n\n</div>'
sage: sphinxify('`x=y`', format='text')
'x=y\n'
sage: sphinxify(':math:`x=y`', format='text')
--
cgit v1.0-1-gd88e

View File

@ -0,0 +1,62 @@
diff --git a/src/bin/sage b/src/bin/sage
index 397f30cbed..3fc473c343 100755
--- a/src/bin/sage
+++ b/src/bin/sage
@@ -980,8 +980,11 @@ if [ "$1" = '-rsyncdist' -o "$1" = "--rsyncdist" ]; then
fi
if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then
+ # Redirect stdin from /dev/null. This helps with running TeX which
+ # tends to ask interactive questions if something goes wrong. These
+ # cause the build to hang. If stdin is /dev/null, TeX just aborts.
shift
- exec sage-python23 -m "sage_setup.docbuild" "$@"
+ exec sage-python23 -m sage_setup.docbuild "$@" </dev/null
fi
if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then
diff --git a/src/doc/common/conf.py b/src/doc/common/conf.py
index 25f94f7b7d..3f07474d9b 100644
--- a/src/doc/common/conf.py
+++ b/src/doc/common/conf.py
@@ -627,7 +627,7 @@ def call_intersphinx(app, env, node, contnode):
sage: for line in open(thematic_index).readlines():
....: if "padics" in line:
....: sys.stdout.write(line)
- <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>
+ <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>
"""
debug_inf(app, "???? Trying intersphinx for %s"%node['reftarget'])
builder = app.builder
diff --git a/src/sage/misc/sphinxify.py b/src/sage/misc/sphinxify.py
index 4f76d4113a..8f426b5989 100644
--- a/src/sage/misc/sphinxify.py
+++ b/src/sage/misc/sphinxify.py
@@ -47,11 +47,11 @@ def sphinxify(docstring, format='html'):
sage: from sage.misc.sphinxify import sphinxify
sage: sphinxify('A test')
- '...<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
+ '<div class="docstring">\n \n <p>A test</p>\n\n\n</div>'
sage: sphinxify('**Testing**\n`monospace`')
- '...<div class="docstring"...<strong>Testing</strong>\n<span class="math"...</p>\n\n\n</div>'
+ '<div class="docstring"...<strong>Testing</strong>\n<span class="math...</p>\n\n\n</div>'
sage: sphinxify('`x=y`')
- '...<div class="docstring">\n \n <p><span class="math">x=y</span></p>\n\n\n</div>'
+ '<div class="docstring">\n \n <p><span class="math notranslate nohighlight">x=y</span></p>\n\n\n</div>'
sage: sphinxify('`x=y`', format='text')
'x=y\n'
sage: sphinxify(':math:`x=y`', format='text')
diff --git a/src/sage_setup/docbuild/sphinxbuild.py b/src/sage_setup/docbuild/sphinxbuild.py
index fda76a4174..d3413239dd 100644
--- a/src/sage_setup/docbuild/sphinxbuild.py
+++ b/src/sage_setup/docbuild/sphinxbuild.py
@@ -207,7 +207,7 @@ def runsphinx():
try:
sys.stdout = SageSphinxLogger(sys.stdout, os.path.basename(output_dir))
sys.stderr = SageSphinxLogger(sys.stderr, os.path.basename(output_dir))
- sphinx.cmdline.main(sys.argv)
+ sphinx.cmdline.main(sys.argv[1:])
finally:
sys.stdout = saved_stdout
sys.stderr = saved_stderr

View File

@ -0,0 +1,31 @@
diff --git a/src/sage/repl/ipython_kernel/install.py b/src/sage/repl/ipython_kernel/install.py
index aa23c8405d..8a87de0591 100644
--- a/src/sage/repl/ipython_kernel/install.py
+++ b/src/sage/repl/ipython_kernel/install.py
@@ -112,7 +112,7 @@ class SageKernelSpec(object):
EXAMPLES::
sage: from sage.repl.ipython_kernel.install import SageKernelSpec
- sage: spec = SageKernelSpec()
+ sage: spec = SageKernelSpec(prefix = tmp_dir())
sage: spec.use_local_mathjax()
sage: mathjax = os.path.join(spec.nbextensions_dir, 'mathjax')
sage: os.path.isdir(mathjax)
@@ -129,7 +129,7 @@ class SageKernelSpec(object):
EXAMPLES::
sage: from sage.repl.ipython_kernel.install import SageKernelSpec
- sage: spec = SageKernelSpec()
+ sage: spec = SageKernelSpec(prefix = tmp_dir())
sage: spec.use_local_jsmol()
sage: jsmol = os.path.join(spec.nbextensions_dir, 'jsmol')
sage: os.path.isdir(jsmol)
@@ -146,7 +146,7 @@ class SageKernelSpec(object):
EXAMPLES::
sage: from sage.repl.ipython_kernel.install import SageKernelSpec
- sage: spec = SageKernelSpec()
+ sage: spec = SageKernelSpec(prefix = tmp_dir())
sage: spec.use_local_threejs()
sage: threejs = os.path.join(spec.nbextensions_dir, 'threejs')
sage: os.path.isdir(threejs)

View File

@ -0,0 +1,13 @@
diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
index 7ff4f21675..1d72168833 100644
--- a/src/sage/misc/package.py
+++ b/src/sage/misc/package.py
@@ -350,7 +350,7 @@ def package_versions(package_type, local=False):
sage: 'gap' in std
True
sage: std['zn_poly']
- ('0.9.p11', '0.9.p11')
+ ('0.9', '0.9.p11')
"""
return {pkg['name']: (pkg['installed_version'], pkg['remote_version']) for pkg in list_packages(package_type, local=local).values()}

View File

@ -0,0 +1,29 @@
{ stdenv
, fetchFromGitHub
, buildPythonPackage
}:
# This has a cyclic dependency with sage. I don't include sage in the
# buildInputs and let python figure it out at runtime. Because of this,
# I don't include the package in the main nipxkgs tree. It wouldn't be useful
# outside of sage anyways (as you could just directly depend on sage and use
# it).
buildPythonPackage rec {
pname = "pyBRiAl";
version = "1.2.3";
# included with BRiAl source
src = fetchFromGitHub {
owner = "BRiAl";
repo = "BRiAl";
rev = "${version}";
sha256 = "0qy4cwy7qrk4zg151cmws5cglaa866z461cnj9wdnalabs7v7qbg";
};
sourceRoot = "source/sage-brial";
meta = with stdenv.lib; {
description = "python implementation of BRiAl";
license = licenses.gpl2;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,42 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, isPy3k
, django
, nose
, twill
, pycrypto
}:
buildPythonPackage rec {
pname = "python-openid";
version = "2.2.5";
disabled = isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "1vvhxlghjan01snfdc4k7ykd80vkyjgizwgg9bncnin8rqz1ricj";
};
propagatedBuildInputs = [
django
twill
pycrypto
];
# Cannot access the djopenid example module.
# I don't know how to fix that (adding the examples dir to PYTHONPATH doesn't work)
doCheck = false;
checkInputs = [ nose ];
checkPhase = ''
nosetests
'';
meta = with stdenv.lib; {
description = "OpenID library for Python";
license = licenses.asl20;
maintainers = with maintainers; [ timokau ];
homepage = https://github.com/openid/python-openid/;
};
}

View File

@ -0,0 +1,162 @@
{ stdenv
, lib
, writeTextFile
, python
, sage-src
, sagelib
, env-locations
, gfortran
, bash
, coreutils
, gnused
, gnugrep
, binutils
, pythonEnv
, python3
, pkg-config
, pari
, gap-libgap-compatible
, libgap
, ecl
, maxima-ecl
, singular
, giac
, palp
, rWrapper
, gfan
, cddlib
, jmol
, tachyon
, glpk
, eclib
, sympow
, nauty
, sqlite
, ppl
, ecm
, lcalc
, rubiks
, flintqs
, openblas-cblas-pc
, flint
, gmp
, mpfr
, pynac
, zlib
, gsl
, ntl
}:
let
runtimepath = (lib.makeBinPath ([
"@sage-local@"
"@sage-local@/build"
pythonEnv
# empty python env to add python wrapper that clears PYTHONHOME (see
# wrapper.nix). This is necessary because sage will call the python3 binary
# (from python2 code). The python2 PYTHONHOME (again set in wrapper.nix)
# will then confuse python3, if it is not overwritten.
python3.buildEnv
gfortran # for inline fortran
stdenv.cc # for cython
bash
coreutils
gnused
gnugrep
binutils.bintools
pkg-config
pari
gap-libgap-compatible
libgap
ecl
maxima-ecl
singular
giac
palp
rWrapper
gfan
cddlib
jmol
tachyon
glpk
eclib
sympow
nauty
sqlite
ppl
ecm
lcalc
rubiks
flintqs
]
));
in
writeTextFile rec {
name = "sage-env";
destination = "/${name}";
text = ''
export PKG_CONFIG_PATH='${lib.concatStringsSep ":" (map (pkg: "${pkg}/lib/pkgconfig") [
# This is only needed in the src/sage/misc/cython.py test and I'm not sure if there's really a use-case
# for it outside of the tests. However since singular and openblas are runtime dependencies anyways
# and openblas-cblas-pc is tiny, it doesn't really hurt to include.
singular
openblas-cblas-pc
])
}'
export SAGE_ROOT='${sage-src}'
export SAGE_LOCAL='@sage-local@'
export SAGE_SHARE='${sagelib}/share'
orig_path="$PATH"
export PATH='${runtimepath}'
# set dependent vars, like JUPYTER_CONFIG_DIR
source "${sage-src}/src/bin/sage-env"
export PATH="${runtimepath}:$orig_path" # sage-env messes with PATH
export SAGE_LOGS="$TMPDIR/sage-logs"
export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sage-src}/src/doc}"
# set locations of dependencies
. ${env-locations}/sage-env-locations
# needed for cython
export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
# cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
export LDFLAGS='${
lib.concatStringsSep " " (map (pkg: "-L${pkg}/lib") [
flint
libgap
glpk
gmp
mpfr
pari
pynac
zlib
eclib
gsl
ntl
jmol
sympow
])
}'
export CFLAGS='${
lib.concatStringsSep " " (map (pkg: "-isystem ${pkg}/include") [
singular
gmp.dev
glpk
flint
libgap
pynac
mpfr.dev
])
}'
export SAGE_LIB='${sagelib}/${python.sitePackages}'
export SAGE_EXTCODE='${sage-src}/src/ext'
# for find_library
export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular]}:$DYLD_LIBRARY_PATH"
'';
}

View File

@ -0,0 +1,205 @@
{ stdenv
, fetchFromGitHub
, fetchpatch
}:
stdenv.mkDerivation rec {
version = "8.2";
name = "sage-src-${version}";
src = fetchFromGitHub {
owner = "sagemath";
repo = "sage";
rev = version;
sha256 = "0d7vc16s7dj23an2cb8v5bhbnc6nsw20qhnnxr0xh8qg629027b8";
};
nixPatches = [
# https://trac.sagemath.org/ticket/25309
(fetchpatch {
name = "spkg-paths.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=97f06fddee920399d4fcda65aa9b0925774aec69&id=a86151429ccce1ddd085e8090ada8ebdf02f3310";
sha256 = "1xb9108rzzkdhn71vw44525620d3ww9jv1fph5a77v9y7nf9wgr7";
})
(fetchpatch {
name = "maxima-fas.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=97f06fddee920399d4fcda65aa9b0925774aec69";
sha256 = "14s50yg3hpw9cp3v581dx7zfmpm2j972im7x30iwki8k45mjvk3i";
})
# https://trac.sagemath.org/ticket/25328
# https://trac.sagemath.org/ticket/25546
# https://trac.sagemath.org/ticket/25722
(fetchpatch {
name = "install-jupyter-kernel-in-correct-prefix.patch";
url = "https://git.sagemath.org/sage.git/patch?id=72167b98e3f64326df6b2c78785df25539472fcc";
sha256 = "0pscnjhm7r2yr2rxnv4kkkq626vwaja720lixa3m3w9rwlxll5a7";
})
./patches/test-in-tmpdir.patch
# https://trac.sagemath.org/ticket/25358
(fetchpatch {
name = "safe-directory-test-without-patch.patch";
url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=dc673c17555efca611f68398d5013b66e9825463";
sha256 = "1hhannz7xzprijakn2w2d0rhd5zv2zikik9p51i87bas3nc658f7";
})
# https://trac.sagemath.org/ticket/25357 rebased on 8.2
./patches/python3-syntax-without-write.patch
# https://trac.sagemath.org/ticket/25314
(fetchpatch {
name = "make-qepcad-test-optional.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=fe294c58bd035ef427e268901d54a6faa0058138";
sha256 = "003d5baf5c0n5rfg010ijwkwz8kg0s414cxwczs2vhdayxdixbix";
})
# https://trac.sagemath.org/ticket/25316
./patches/python-5755-hotpatch.patch
# https://trac.sagemath.org/ticket/25354
# https://trac.sagemath.org/ticket/25531
(fetchpatch {
name = "cysignals-include.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=28778bd25a37c80884d2b24e0683fb2989300cef";
sha256 = "0fiiiw91pgs8avm9ggj8hb64bhqzl6jcw094d94nhirmh8w2jmc5";
})
# https://trac.sagemath.org/ticket/25315
(fetchpatch {
name = "find-libraries-in-dyld-library-path.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=20d4593876ce9c6004eac2ab6fd61786d0d96a06";
sha256 = "1k3afq3qlzmgqwx6rzs5wv153vv9dsf5rk8pi61g57l3r3npbjmc";
})
# Pari upstream has since accepted a patch, so this patch won't be necessary once sage updates pari.
# https://trac.sagemath.org/ticket/25312
./patches/pari-stackwarn.patch
# https://trac.sagemath.org/ticket/25311
./patches/zn_poly_version.patch
# https://trac.sagemath.org/ticket/25345
# (upstream patch doesn't apply on 8.2 source)
./patches/dochtml-optional.patch
];
packageUpgradePatches = [
# matplotlib 2.2.2 deprecated `normed` (replaced by `density`).
# This patch only ignores the warning. It would be equally easy to fix it
# (by replacing all mentions of `normed` by `density`), but its better to
# stay close to sage upstream. I didn't open an upstream ticket about it
# because the matplotlib update also requires a new dependency (kiwisolver)
# and I don't want to invest the time to learn how to add it.
./patches/matplotlib-normed-deprecated.patch
# Update to 20171219 broke the doctests because of insignificant precision
# changes, make the doctests less fragile.
# I didn't open an upstream ticket because its not entirely clear if
# 20171219 is really "released" yet. It is listed on the github releases
# page, but not marked as "latest release" and the homepage still links to
# the last version.
./patches/eclib-regulator-precision.patch
# sphinx 1.6 -> 1.7 upgrade
# https://trac.sagemath.org/ticket/24935
./patches/sphinx-1.7.patch
# https://trac.sagemath.org/ticket/25320
(fetchpatch {
name = "zero_division_error_formatting.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=f79070ddd09fa0ad6b340b097bd8d690a7aa35f0";
sha256 = "02wsc3wbp8g8dk5jcjyv18d9v537h3zp5v8lwir46j4na4kj0dlb";
})
# Adapt hashes to new boost version
# https://trac.sagemath.org/ticket/22243
# (this ticket doesn't only upgrade boost but also avoids this problem in the future)
(fetchpatch {
name = "boost-upgrade.patch";
url = "https://git.sagemath.org/sage.git/patch?id=a24a9c6b30b93957333a3116196214a931325b69";
sha256 = "0z3870g2ms2a81vnw08dc2i4k7jr62w8fggvcdwaavgd1wvdxwfl";
})
# gfan 0.6.2
# https://trac.sagemath.org/ticket/23353
(fetchpatch {
name = "gfan-update.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=420215fc469cde733ec7a339e59b78ad6eec804c&id=112498a293ea2bf563e41aed35f1aa608f01b349";
sha256 = "0ga3hkx8cr23dpc919lgvpi5lmy0d728jkq9z6kf0fl9s8g31mxb";
})
# New glpk version has new warnings, filter those out until upstream sage has found a solution
# https://trac.sagemath.org/ticket/24824
(fetchpatch {
url = "https://salsa.debian.org/science-team/sagemath/raw/58bbba93a807ca2933ca317501d093a1bb4b84db/debian/patches/dt-version-glpk-4.65-ignore-warnings.patch";
sha256 = "0b9293v73wb4x13wv5zwyjgclc01zn16msccfzzi6znswklgvddp";
stripLen = 1;
})
# https://trac.sagemath.org/ticket/25329
(fetchpatch {
name = "dont-check-exact-glpk-version.patch";
url = "https://git.sagemath.org/sage.git/patch?id2=8bdc326ba57d1bb9664f63cf165a9e9920cc1afc&id=89d068d8d77316bfffa6bf8e9ebf70b3b3b88e5c";
sha256 = "00knwxs6fmymfgfl0q5kcavmxm9sf90a4r76y35n5s55gj8pl918";
})
# https://trac.sagemath.org/ticket/25355
(fetchpatch {
name = "maxima-5.41.0.patch";
url = "https://git.sagemath.org/sage.git/patch/?id=87328023c4739abdf24108038201e3fa9bdfc739";
sha256 = "0hxi7qr5mfx1bc32r8j7iba4gzd7c6v63asylyf5cbyp86azpb7i";
})
# Update cddlib from 0.94g to 0.94h.
# https://trac.sagemath.org/ticket/25341 (doesn't apply to 8.2 sources)
(fetchpatch {
url = "https://salsa.debian.org/science-team/sagemath/raw/58bbba93a807ca2933ca317501d093a1bb4b84db/debian/patches/u2-version-cddlib-094h.patch";
sha256 = "0fmw7pzbaxs2dshky6iw9pr8i23p9ih2y2lw661qypdrxh5xw03k";
stripLen = 1;
})
./patches/revert-269c1e1551285.patch
# Only formatting changes.
# https://trac.sagemath.org/ticket/25260
./patches/numpy-1.14.3.patch
# https://trac.sagemath.org/ticket/24374
(fetchpatch {
name = "networkx-2.1.patch";
url = "https://salsa.debian.org/science-team/sagemath/raw/487df9ae48ca1d93d9b1cb3af8745d31e30fb741/debian/patches/u0-version-networkx-2.1.patch";
sha256 = "1xxxawygbgxgvlv7b4w8hhzgdnva4rhmgdxaiaa3pwdwln0yc750";
stripLen = 1;
})
# https://trac.sagemath.org/ticket/24927 rebased
./patches/arb-2.13.0.patch
# https://trac.sagemath.org/ticket/24838 rebased
./patches/pynac-0.7.22.patch
];
patches = nixPatches ++ packageUpgradePatches;
postPatch = ''
# make sure shebangs etc are fixed, but sage-python23 still works
find . -type f -exec sed \
-e 's/sage-python23/python/g' \
-i {} \;
echo '#!${stdenv.shell}
python "$@"' > build/bin/sage-python23
# Do not use sage-env-config (generated by ./configure).
# Instead variables are set manually.
echo '# do nothing' > src/bin/sage-env-config
'';
configurePhase = "# do nothing";
buildPhase = "# do nothing";
installPhase = ''
cp -r . "$out"
'';
}

View File

@ -0,0 +1,129 @@
{ stdenv
, lib
, makeWrapper
, sage-env
, sage-src
, sagelib
, sagedoc
, openblasCompat
, openblas-blas-pc
, openblas-cblas-pc
, openblas-lapack-pc
, pkg-config
, three
, singular
, libgap
, gap-libgap-compatible
, gcc
, giac
, maxima-ecl
, pari
, gmp
, gfan
, python2
, flintqs
, eclib
, ntl
, ecm
, pynac
, pythonEnv
}:
let
buildInputs = [
pythonEnv # for patchShebangs
makeWrapper
pkg-config
openblasCompat # lots of segfaults with regular (64 bit) openblas
openblas-blas-pc
openblas-cblas-pc
openblas-lapack-pc
singular
three
pynac
giac
libgap
gap-libgap-compatible
pari
gmp
gfan
maxima-ecl
eclib
flintqs
ntl
ecm
];
# remove python prefix, replace "-" in the name by "_", apply patch_names
# python2.7-some-pkg-1.0 -> some_pkg-1.0
pkg_to_spkg_name = pkg: patch_names: let
parts = lib.splitString "-" pkg.name;
# remove python2.7-
stripped_parts = if (builtins.head parts) == python2.libPrefix then builtins.tail parts else parts;
version = lib.last stripped_parts;
orig_pkgname = lib.init stripped_parts;
pkgname = patch_names (lib.concatStringsSep "_" orig_pkgname);
in pkgname + "-" + version;
# return the names of all dependencies in the transitive closure
transitiveClosure = dep:
if isNull dep then
# propagatedBuildInputs might contain null
# (although that might be considered a programming error in the derivation)
[]
else
[ dep ] ++ (
if builtins.hasAttr "propagatedBuildInputs" dep then
lib.unique (builtins.concatLists (map transitiveClosure dep.propagatedBuildInputs))
else
[]
);
allInputs = lib.remove null (buildInputs ++ pythonEnv.extraLibs);
transitiveDeps = lib.unique (builtins.concatLists (map transitiveClosure allInputs ));
# fix differences between spkg and sage names
# (could patch sage instead, but this is more lightweight and also works for packages depending on sage)
patch_names = builtins.replaceStrings [
"zope.interface"
"node_three"
] [
"zope_interface"
"threejs"
];
# spkg names (this_is_a_package-version) of all transitive deps
input_names = map (dep: pkg_to_spkg_name dep patch_names) transitiveDeps;
in
stdenv.mkDerivation rec {
version = sage-src.version;
name = "sage-with-env-${version}";
inherit buildInputs;
src = sage-src;
configurePhase = "#do nothing";
buildPhase = ''
mkdir installed
for pkg in ${lib.concatStringsSep " " input_names}; do
touch "installed/$pkg"
done
'';
installPhase = ''
mkdir -p "$out/var/lib/sage"
cp -r installed $out/var/lib/sage
mkdir -p "$out/etc"
# sage tests will try to create this file if it doesn't exist
touch "$out/etc/sage-started.txt"
mkdir -p "$out/build"
cp -r src/bin "$out/bin"
cp -r build/bin "$out/build/bin"
cp -f '${sage-env}/sage-env' "$out/bin/sage-env"
substituteInPlace "$out/bin/sage-env" \
--subst-var-by sage-local "$out"
'';
}

View File

@ -0,0 +1,41 @@
{ stdenv
, makeWrapper
, sage
, sage-src
, sagedoc
, withDoc
}:
stdenv.mkDerivation rec {
version = sage.version;
name = "sage-wrapper-${version}";
buildInputs = [
makeWrapper
];
unpackPhase = "#do nothing";
configurePhase = "#do nothing";
buildPhase = "#do nothing";
installPhase = ''
mkdir -p "$out/bin"
makeWrapper "${sage}/bin/sage" "$out/bin/sage" \
--set SAGE_DOC_SRC_OVERRIDE "${sage-src}/src/doc" ${
stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
}
'';
doInstallCheck = withDoc;
installCheckPhase = ''
export HOME="$TMPDIR/sage-home"
mkdir -p "$HOME"
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
'';
meta = with stdenv.lib; {
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
license = licenses.gpl2;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,32 @@
{ stdenv
, sage-with-env
, makeWrapper
}:
stdenv.mkDerivation rec {
version = sage-with-env.version;
name = "sage-${version}";
buildInputs = [
makeWrapper
];
unpackPhase = "#do nothing";
configurePhase = "#do nothing";
buildPhase = "#do nothing";
installPhase = ''
mkdir -p "$out/bin"
# Like a symlink, but make sure that $0 points to the original.
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage"
'';
doInstallCheck = true;
installCheckPhase = ''
export HOME="$TMPDIR/sage-home"
mkdir -p "$HOME"
# "--long" tests are in the order of 1h, without "--long" its 1/2h
"$out/bin/sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage --long --all
'';
}

View File

@ -0,0 +1,97 @@
{ pkgs
, stdenv
, sage-src
, env-locations
, sage-with-env
, sagelib
, python2
, psutil
, future
, sphinx
, sagenb
, maxima-ecl
, networkx
, scipy
, sympy
, matplotlib
, pillow
, ipykernel
, jupyter_client
, tachyon
, jmol
, ipywidgets
, typing
, cddlib
, pybrial
}:
stdenv.mkDerivation rec {
version = sage-src.version;
name = "sagedoc-${version}";
# Building the documentation has many dependencies, because all documented
# modules are imported and because matplotlib is used to produce plots.
buildInputs = [
sagelib
python2
psutil
future
sphinx
sagenb
maxima-ecl
networkx
scipy
sympy
matplotlib
pillow
ipykernel
jupyter_client
tachyon
jmol
ipywidgets
typing
cddlib
pybrial
];
unpackPhase = ''
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
cp -r "${sage-src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
'';
buildPhase = ''
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
export HOME="$TMPDIR/sage_home"
mkdir -p "$HOME"
${sage-with-env}/bin/sage -python -m sage_setup.docbuild \
--mathjax \
--no-pdf-links \
all html
'';
installPhase = ''
cd "$SAGE_DOC_OVERRIDE"
mkdir -p "$out/share/doc/sage"
cp -r html "$out"/share/doc/sage
# Replace duplicated files by symlinks (Gentoo)
cd "$out"/share/doc/sage
mv html/en/_static{,.tmp}
for _dir in `find -name _static` ; do
rm -r $_dir
ln -s /share/doc/sage/html/en/_static $_dir
done
mv html/en/_static{.tmp,}
'';
doCheck = true;
checkPhase = ''
${sage-with-env}/bin/sage -t --optional=dochtml --all
'';
}

View File

@ -0,0 +1,139 @@
{ stdenv
, sage-src
, perl
, buildPythonPackage
, arb
, openblasCompat
, openblas-blas-pc
, openblas-cblas-pc
, openblas-lapack-pc
, brial
, cliquer
, cypari2
, cysignals
, cython
, ecl
, eclib
, ecm
, flint
, gd
, givaro
, glpk
, gsl
, iml
, jinja2
, lcalc
, lrcalc
, libgap
, linbox
, m4ri
, m4rie
, libmpc
, mpfi
, ntl
, numpy
, pari
, pkgconfig
, planarity
, ppl
, pynac
, python
, ratpoints
, readline
, rankwidth
, symmetrica
, zn_poly
, fflas-ffpack
, boost
, singular
, pip
, jupyter_core
}:
buildPythonPackage rec {
format = "other";
version = sage-src.version;
pname = "sagelib";
src = sage-src;
nativeBuildInputs = [
iml
perl
openblas-blas-pc
openblas-cblas-pc
openblas-lapack-pc
jupyter_core
];
buildInputs = [
gd
readline
];
propagatedBuildInputs = [
cypari2
jinja2
numpy
pkgconfig
boost
arb
brial
cliquer
ecl
eclib
ecm
fflas-ffpack
flint
givaro
glpk
gsl
lcalc
libgap
libmpc
linbox
lrcalc
m4ri
m4rie
mpfi
ntl
openblasCompat
pari
planarity
ppl
pynac
rankwidth
ratpoints
singular
symmetrica
zn_poly
pip
cython
cysignals
];
buildPhase = ''
export SAGE_ROOT="$PWD"
export SAGE_LOCAL="$SAGE_ROOT"
export SAGE_SHARE="$SAGE_LOCAL/share"
export JUPYTER_PATH="$SAGE_LOCAL/jupyter"
export PATH="$SAGE_ROOT/build/bin:$SAGE_ROOT/src/bin:$PATH"
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
mkdir -p "var/lib/sage/installed"
cd src
source bin/sage-dist-helpers
${python.interpreter} -u setup.py --no-user-cfg build
'';
installPhase = ''
${python.interpreter} -u setup.py --no-user-cfg install --prefix=$out
rm -r "$out/${python.sitePackages}/sage/cython_debug"
'';
}

View File

@ -0,0 +1,49 @@
# Has a cyclic dependency with sage (not expressed here) and is not useful outside of sage
{ stdenv
, fetchpatch
, python
, buildPythonPackage
, fetchFromGitHub
, mathjax
, twisted
, flask
, flask-oldsessions
, flask-openid
, flask-autoindex
, flask-babel
}:
buildPythonPackage rec {
pname = "sagenb";
version = "2018-06-26"; # not 1.0.1 because of new flask syntax
src = fetchFromGitHub {
owner = "sagemath";
repo = "sagenb";
rev = "b360a0172e15501fb0163d02dce713a561fee2af";
sha256 = "12anydw0v9w23rbc0a94bqmjhjdir9h820c5zdhipw9ccdcc2jlf";
};
propagatedBuildInputs = [
twisted
flask
flask-oldsessions
flask-openid
flask-autoindex
flask-babel
];
# tests depend on sage
doCheck = false;
meta = with stdenv.lib; {
description = "Sage Notebook";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ timokau ];
};
# let sagenb use mathjax
postInstall = ''
ln -s ${mathjax}/lib/node_modules/mathjax "$out/${python.sitePackages}/mathjax"
'';
}

View File

@ -1,36 +0,0 @@
diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg
index 83e61a7e0d..942ba206c7 100755
--- a/build/bin/sage-spkg
+++ b/build/bin/sage-spkg
@@ -648,8 +648,12 @@ if ! sage-apply-patches; then
error_msg "Error applying patches"
exit 1
fi
+
+@bash@/bin/bash @patchSageShebangs@ .
+
cd ..
+
##################################################################
# The package has been extracted, prepare for installation
##################################################################
@@ -671,7 +675,7 @@ write_script_wrapper() {
local tmpscript="$(dirname "$script")/.tmp-${script##*/}"
cat > "$tmpscript" <<__EOF__
-#!/usr/bin/env bash
+#! @bash@/bin/bash
export SAGE_ROOT="$SAGE_ROOT"
export SAGE_SRC="$SAGE_SRC"
@@ -833,6 +837,9 @@ if [ "$UNAME" = "CYGWIN" ]; then
sage-rebase.sh "$SAGE_LOCAL" 2>/dev/null
fi
+@bash@/bin/bash @patchSageShebangs@ .
+@bash@/bin/bash @patchSageShebangs@ "$out/bin"
+
echo "Successfully installed $PKG_NAME"
if [ "$SAGE_CHECK" = "yes" ]; then

View File

@ -1,20 +0,0 @@
diff --git a/build/pkgs/giac/spkg-install b/build/pkgs/giac/spkg-install
index bdd8df6cb8..3fd7a3ef8a 100644
--- a/build/pkgs/giac/spkg-install
+++ b/build/pkgs/giac/spkg-install
@@ -2,6 +2,15 @@
## Giac
###########################################
+# Fix hardcoded paths, while making sure to only update timestamps of actually
+# changed files (otherwise confuses make)
+grep -rlF '/bin/cp' . | while read file
+do
+ sed -e 's@/bin/cp@cp@g' -i "$file"
+done
+
+# Fix input parser syntax
+sed -e 's@yylex (&yylval)@yylex (\&yyval, scanner)@gp' -i 'src/src/input_parser.cc'
if [ "$SAGE_LOCAL" = "" ]; then
echo "SAGE_LOCAL undefined ... exiting";

View File

@ -1,18 +0,0 @@
diff --git a/build/pkgs/git/spkg-install b/build/pkgs/git/spkg-install
index 87874de3d8..b0906245fa 100644
--- a/build/pkgs/git/spkg-install
+++ b/build/pkgs/git/spkg-install
@@ -33,6 +33,13 @@ fi
cd src
+# Fix hardcoded paths, while making sure to only update timestamps of actually
+# changed files (otherwise confuses make)
+grep -rlF '/usr/bin/perl' . | while read file
+do
+ sed -e 's@/usr/bin/perl@perl@g' -i "$file"
+done
+
# We don't want to think about Fink or Macports
export NO_FINK=1
export NO_DARWIN_PORTS=1

View File

@ -1,13 +0,0 @@
diff --git a/build/pkgs/python3/spkg-build b/build/pkgs/python3/spkg-build
index 56db087ae5..b450703c5f 100644
--- a/build/pkgs/python3/spkg-build
+++ b/build/pkgs/python3/spkg-build
@@ -27,6 +27,8 @@ fi
export EXTRA_CFLAGS="`testcflags.sh -Wno-unused` $CFLAGS"
unset CFLAGS
+export LDFLAGS="$LDFLAGS -lcrypt"
+
if [ "$UNAME" = Darwin ]; then
PYTHON_CONFIGURE="--disable-toolbox-glue $PYTHON_CONFIGURE"

View File

@ -1,18 +0,0 @@
diff --git a/build/pkgs/singular/spkg-install b/build/pkgs/singular/spkg-install
index 8caafb1699..3c34e6608a 100644
--- a/build/pkgs/singular/spkg-install
+++ b/build/pkgs/singular/spkg-install
@@ -2,6 +2,13 @@
## Singular
###########################################
+# Fix hardcoded paths, while making sure to only update timestamps of actually
+# changed files (otherwise confuses make)
+grep -rlF '/bin/rm' . | while read file
+do
+ sed -e 's@/bin/rm@rm@g' -i "$file"
+done
+
if [ -z "$SAGE_LOCAL" ]; then
echo >&2 "Error: SAGE_LOCAL undefined -- exiting..."
echo >&2 "Maybe run 'sage -sh'?"

View File

@ -1,14 +1,15 @@
{stdenv, fetchurl}:
{ stdenv
, fetchurl
, fetchpatch
}:
stdenv.mkDerivation rec {
name = "symmetrica-${version}";
version = "2.0";
# or fetchFromGitHub(owner,repo,rev) or fetchgit(rev)
src = fetchurl {
url = "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/SYM2_0_tar.gz";
sha256 = "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz";
name = "symmetrica-2.0.tar.gz";
};
buildInputs = [];
sourceRoot = ".";
installPhase = ''
mkdir -p "$out"/{lib,share/doc/symmetrica,include/symmetrica}
@ -18,6 +19,22 @@ stdenv.mkDerivation rec {
cp *.h "$out/include/symmetrica"
cp README *.doc "$out/share/doc/symmetrica"
'';
patches = [
# don't show banner ("SYMMETRICA VERSION X - STARTING)
# it doesn't contain very much helpful information and a banner is not ideal for a library
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/de.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0df0vqixcfpzny6dkhyj87h8aznz3xn3zfwwlj8pd10bpb90k6gb";
})
# use int32_t and uint32_t for type INT
# see https://trac.sagemath.org/ticket/13413
(fetchpatch {
name = "fix_64bit_integer_overflow.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/int32.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0p33c85ck4kd453z687ni4bdcqr1pqx2756j7aq11bf63vjz4cyz";
})
];
meta = {
inherit version;
description = ''A collection of routines for representation theory and combinatorics'';

View File

@ -319,51 +319,48 @@ rec {
];
# Sage mirrors (http://www.sagemath.org/mirrors.html)
sagemath = [
sageupstream = [
# Africa
http://sagemath.polytechnic.edu.na/src/
ftp://ftp.sun.ac.za/pub/mirrors/www.sagemath.org/src/
http://sagemath.mirror.ac.za/src/
https://ftp.leg.uct.ac.za/pub/packages/sage/src/
http://mirror.ufs.ac.za/sagemath/src/
http://sagemath.polytechnic.edu.na/spkg/upstream/
ftp://ftp.sun.ac.za/pub/mirrors/www.sagemath.org/spkg/upstream/
http://sagemath.mirror.ac.za/spkg/upstream/
https://ftp.leg.uct.ac.za/pub/packages/sage/spkg/upstream/
http://mirror.ufs.ac.za/sagemath/spkg/upstream/
# America, North
http://mirrors-usa.go-parts.com/sage/sagemath/src/
http://mirrors.mit.edu/sage/src/
http://www.cecm.sfu.ca/sage/src/
http://files.sagemath.org/src/
http://mirror.clibre.uqam.ca/sage/src/
https://mirrors.xmission.com/sage/src/
http://mirrors-usa.go-parts.com/sage/sagemath/spkg/upstream/
http://mirrors.mit.edu/sage/spkg/upstream/
http://www.cecm.sfu.ca/sage/spkg/upstream/
http://files.sagemath.org/spkg/upstream/
http://mirror.clibre.uqam.ca/sage/spkg/upstream/
https://mirrors.xmission.com/sage/spkg/upstream/
# America, South
http://sagemath.c3sl.ufpr.br/src/
http://linorg.usp.br/sage/
http://sagemath.c3sl.ufpr.br/spkg/upstream/
http://linorg.usp.br/sage/spkg/upstream
# Asia
http://sage.asis.io/src/
http://mirror.hust.edu.cn/sagemath/src/
https://ftp.iitm.ac.in/sage/src/
http://ftp.kaist.ac.kr/sage/src/
http://ftp.riken.jp/sagemath/src/
https://mirrors.tuna.tsinghua.edu.cn/sagemath/src/
https://mirrors.ustc.edu.cn/sagemath/src/
http://ftp.tsukuba.wide.ad.jp/software/sage/src/
http://ftp.yz.yamagata-u.ac.jp/pub/math/sage/src/
https://mirror.yandex.ru/mirrors/sage.math.washington.edu/src/
http://sage.asis.io/spkg/upstream/
http://mirror.hust.edu.cn/sagemath/spkg/upstream/
https://ftp.iitm.ac.in/sage/spkg/upstream/
http://ftp.kaist.ac.kr/sage/spkg/upstream/
http://ftp.riken.jp/sagemath/spkg/upstream/
https://mirrors.tuna.tsinghua.edu.cn/sagemath/spkg/upstream/
https://mirrors.ustc.edu.cn/sagemath/spkg/upstream/
http://ftp.tsukuba.wide.ad.jp/software/sage/spkg/upstream/
http://ftp.yz.yamagata-u.ac.jp/pub/math/sage/spkg/upstream/
https://mirror.yandex.ru/mirrors/sage.math.washington.edu/spkg/upstream/
# Australia
http://echidna.maths.usyd.edu.au/sage/src/
http://echidna.maths.usyd.edu.au/sage/spkg/upstream/
# Europe
http://sage.mirror.garr.it/mirrors/sage/src/
http://sunsite.rediris.es/mirror/sagemath/src/
http://mirror.switch.ch/mirror/sagemath/src/
http://mirrors.fe.up.pt/pub/sage/src/
http://www-ftp.lip6.fr/pub/math/sagemath/src/
http://ftp.ntua.gr/pub/sagemath/src/
# Old versions
http://sagemath.org/src-old/
http://sage.mirror.garr.it/mirrors/sage/spkg/upstream/
http://sunsite.rediris.es/mirror/sagemath/spkg/upstream/
http://mirror.switch.ch/mirror/sagemath/spkg/upstream/
http://mirrors.fe.up.pt/pub/sage/spkg/upstream/
http://www-ftp.lip6.fr/pub/math/sagemath/spkg/upstream/
http://ftp.ntua.gr/pub/sagemath/spkg/upstream/
];
# MySQL mirrors

View File

@ -0,0 +1,31 @@
{ stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
name = "combinatorial_designs-${version}";
version = "20140630";
src = fetchurl {
url = "mirror://sageupstream/combinatorial_designs/combinatorial_designs-${version}.tar.bz2";
sha256 = "0bj8ngiq59hipa6izi6g5ph5akmy4cbk0vlsb0wa67f7grnnqj69";
};
installPhase = ''
mkdir -p "$out/share/combinatorial_designs"
mv * "$out/share/combinatorial_designs"
'';
meta = with stdenv.lib; {
description = "Data for Combinatorial Designs";
longDescription = ''
Current content:
- The table of MOLS (10 000 integers) from the Handbook of Combinatorial
Designs, 2ed.
'';
license = licenses.publicDomain;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,43 @@
{ stdenv
, fetchurl
, python
}:
stdenv.mkDerivation rec {
name = "conway_polynomials-${version}";
version = "0.5";
pythonEnv = python.withPackages (ps: with ps; [ six ]);
src = fetchurl {
url = "mirror://sageupstream/conway_polynomials/conway_polynomials-${version}.tar.bz2";
sha256 = "05zb1ly9x2bbscqv0jgc45g48xx77mfs7qdbqhn4ihmihn57iwnq";
};
# Script that creates the "database" (nested python array) and pickles it
spkg-install = fetchurl {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/conway_polynomials/spkg-install.py?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0m12nfb37j3bn4bp06ddgnyp2d6z0hg5f83pbbjszxw7vxs33a82";
};
installPhase = ''
# directory layout as spkg-install.py expects
dir="$PWD"
cd ..
ln -s "$dir" "src"
# environment spkg-install.py expects
mkdir -p "$out/share"
export SAGE_SHARE="$out/share"
export PYTHONPATH=$PWD
${pythonEnv.interpreter} ${spkg-install}
'';
meta = with stdenv.lib; {
description = "Contains a small database of Conway polynomials.";
license = licenses.gpl2;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,51 @@
{ stdenv
, fetchurl
, python
}:
stdenv.mkDerivation rec {
pname = "elliptic_curves";
version = "0.8";
name = "${pname}-${version}";
src = fetchurl {
url = "mirror://sageupstream/${pname}/${pname}-${version}.tar.bz2";
sha256 = "0pzaym44x88dn8rydiwqgm73yghzlgf7gqvd7qqsrsdl2vyp091w";
};
# Script that creates the sqlite database from the allcurves textfile
spkg-install = fetchurl {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/${pname}/spkg-install.py?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "116g684i6mvs11fvb6fzfsr4fn903axn31vigdyb8bgpf8l4hvc5";
};
installPhase = ''
# directory layout as spkg-install.py expects
dir="$PWD"
cd ..
ln -s "$dir" "src"
# environment spkg-install.py expects
mkdir -p "$out/share"
export SAGE_SHARE="$out/share"
export PYTHONPATH=$PWD
${python.interpreter} ${spkg-install}
'';
meta = with stdenv.lib; {
description = "Databases of elliptic curves";
longDescription = ''
Includes two databases:
* A small subset of the data in John Cremona's database of elliptic curves up
to conductor 10000. See http://www.warwick.ac.uk/~masgaj/ftp/data/ or
http://sage.math.washington.edu/cremona/INDEX.html
* William Stein's database of interesting curves
'';
license = licenses.gpl2;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,26 @@
{ stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
pname = "graphs";
version = "20161026";
name = "${pname}-${version}";
src = fetchurl {
url = "mirror://sageupstream/${pname}/${pname}-${version}.tar.bz2";
sha256 = "0a2b5lly9nifphvknz88rrhfbbc8vqnlqcv19zdpfq8h8nnyjbb2";
};
installPhase = ''
mkdir -p "$out/share/graphs"
cp * "$out/share/graphs/"
'';
meta = with stdenv.lib; {
description = "A database of graphs";
license = licenses.gpl2;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,26 @@
{ stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
version = "20080411";
name = "pari-galdata-${version}";
src = fetchurl {
url = "http://pari.math.u-bordeaux.fr/pub/pari/packages/galdata.tgz";
sha256 = "1pch6bk76f1i6cwwgm7hhxi5h71m52lqayp4mnyj0jmjk406bhdp";
};
installPhase = ''
mkdir -p "$out/share/pari"
cp -R * "$out/share/pari/"
'';
meta = with stdenv.lib; {
description = "PARI database needed to compute Galois group in degrees 8 through 11";
homepage = http://pari.math.u-bordeaux.fr/;
license = licenses.gpl2Plus;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,26 @@
{ stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
version = "20090618";
name = "pari-seadata-small-${version}";
src = fetchurl {
url = "http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata-small.tgz";
sha256 = "13qafribxwkz8h3haa0cng7arz0kh7398br4y7vqs9ib8w9yjnxz";
};
installPhase = ''
mkdir -p "$out/share/pari"
cp -R * "$out/share/pari/"
'';
meta = with stdenv.lib; {
description = "PARI database needed by ellap for large primes";
homepage = http://pari.math.u-bordeaux.fr/;
license = licenses.gpl2Plus;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -0,0 +1,26 @@
{ stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
pname = "polytopes_db";
version = "20170220";
name = "${pname}-${version}";
src = fetchurl {
url = "mirror://sageupstream/${pname}/${pname}-${version}.tar.bz2";
sha256 = "1q0cd811ilhax4dsj9y5p7z8prlalqr7k9mzq178c03frbgqny6b";
};
installPhase = ''
mkdir -p "$out/share/reflexive_polytopes"
cp -R * "$out/share/reflexive_polytopes/"
'';
meta = with stdenv.lib; {
description = "Reflexive polytopes database";
license = licenses.gpl2;
platforms = platforms.all;
maintainers = with maintainers; [ timokau ];
};
}

View File

@ -53,6 +53,14 @@ stdenv.mkDerivation {
url = "https://gitlab.com/embeddable-common-lisp/ecl/commit/caba1989f40ef917e7486f41b9cd5c7e3c5c2d79.patch";
sha256 = "07vw91psbc9gdn8grql46ra8lq3bgkzg5v480chnbryna4sv6lbb";
})
(fetchpatch {
# Fix getcwd with long pathnames
# Rebased version of
# https://gitlab.com/embeddable-common-lisp/ecl/commit/ac5f011f57a85a38627af154bc3ee7580e7fecd4.patch
name = "getcwd.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/ecl/patches/16.1.2-getcwd.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "1fbi8gn7rv8nqff5mpaijsrch3k3z7qc5cn4h1vl8qrr8xwqlqhb";
})
];
hardeningDisable = [ "format" ];

View File

@ -1,4 +1,4 @@
{stdenv, fetchFromGitHub, mpir, gmp, mpfr, flint}:
{stdenv, fetchFromGitHub, fetchpatch, mpir, gmp, mpfr, flint}:
stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "arb";
@ -17,6 +17,14 @@ stdenv.mkDerivation rec {
"--with-flint=${flint}"
];
doCheck = true;
patches = [
# https://github.com/fredrik-johansson/arb/pull/210, included in next release
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/fredrik-johansson/arb/pull/210.patch";
name = "return-exact-zero-where-possible.patch";
sha256 = "01j9npnpmwh4dla9i05qdn606hy34gy9bz7c9bbsqm7az3n7pxjg";
})
];
meta = {
inherit version;
description = ''A library for arbitrary-precision interval arithmetic'';

View File

@ -1,10 +1,17 @@
{stdenv, fetchurl, gmp}:
{ stdenv
, fetchurl
, gmp
}:
# will probably be obsolte (or at leat built from the upstream gap sources) soon (gap 4.9?). See
# - https://github.com/gap-system/gap/projects/5#card-6239828
# - https://github.com/markuspf/gap/issues/2
# - https://trac.sagemath.org/ticket/22626
stdenv.mkDerivation rec {
name = "libgap-${version}";
# Has to be the same version as "gap"
version = "4.8.6";
# or fetchFromGitHub(owner,repo,rev) or fetchgit(rev)
src = fetchurl {
url = "http://mirrors.mit.edu/sage/spkg/upstream/libgap/libgap-${version}.tar.gz";
url = "mirror://sageupstream/libgap/libgap-${version}.tar.gz";
sha256 = "1h5fx5a55857w583ql7ly2jl49qyx9mvs7j5abys00ra9gzrpn5v";
};
buildInputs = [gmp];

View File

@ -5,7 +5,6 @@
, givaro
, pkgconfig
, openblas
, liblapack
, fflas-ffpack
, gmpxx
, optimize ? false # impure
@ -30,7 +29,6 @@ stdenv.mkDerivation rec {
buildInputs = [
givaro
(liblapack.override {shared = true;})
openblas
gmpxx
fflas-ffpack
@ -38,7 +36,6 @@ stdenv.mkDerivation rec {
configureFlags = [
"--with-blas-libs=-lopenblas"
"--with-lapack-libs=-llapack"
"--disable-optimization"
] ++ stdenv.lib.optionals (!optimize) [
# disable SIMD instructions (which are enabled *when available* by default)

View File

@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
# original at http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-${version}.tar.gz, no longer available
# "newer" version at google code https://code.google.com/archive/p/l-calc/source/default/source
url = "http://mirrors.mit.edu/sage/spkg/upstream/lcalc/lcalc-${version}.tar.bz2";
url = "mirror://sageupstream/lcalc/lcalc-${version}.tar.bz2";
sha256 = "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43";
};

View File

@ -76,11 +76,10 @@ let
if blas64_ != null
then blas64_
else hasPrefix "x86_64" stdenv.system;
version = "0.3.0";
in
stdenv.mkDerivation {
stdenv.mkDerivation rec {
name = "openblas-${version}";
version = "0.3.0";
src = fetchurl {
url = "https://github.com/xianyi/OpenBLAS/archive/v${version}.tar.gz";
sha256 = "18giv3lsh8cva01z4rhsx8jvgliknni0jp7vxkc69qxb14vm8lfg";

View File

@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
name = "${pname}-${version}";
src = fetchurl {
url = "http://mirrors.mit.edu/sage/spkg/upstream/rw/rw-${version}.tar.gz";
url = "mirror://sageupstream/rw/rw-${version}.tar.gz";
sha256 = "1rv2v42x2506x7f10349m1wpmmfxrv9l032bkminni2gbip9cjg0";
};

View File

@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
name = "${pname}-${version}";
src = fetchurl {
url = "http://mirrors.mit.edu/sage/spkg/upstream/rubiks/rubiks-${version}.tar.bz2";
url = "mirror://sageupstream/rubiks/rubiks-${version}.tar.bz2";
sha256 = "0zdmkb0j1kyspdpsszzb2k3279xij79jkx0dxd9f3ix1yyyg3yfq";
};

View File

@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
# Original website no longer reachable
url = "http://mirrors.mit.edu/sage/spkg/upstream/sympow/sympow-${version}.tar.bz2";
url = "mirror://sageupstream/sympow/sympow-${version}.tar.bz2";
sha256 = "0hphs7ia1wr5mydf288zvwj4svrymfpadcg3pi6w80km2yg5bm3c";
};
@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
install -d datafiles "$out/share/sympow/datafiles"
install -D datafiles/* --target-directory "$out/share/sympow/datafiles/"
install *.gp "$out/share/sympow/"
install -Dm755 sympow "$out/share/sympow/sympow"
install -D new_data "$out/bin/new_data"

View File

@ -38,6 +38,7 @@ stdenv.mkDerivation rec {
arch = if stdenv.system == "x86_64-linux" then "linux-64-thr" else
if stdenv.system == "i686-linux" then "linux-thr" else
if stdenv.system == "aarch64-linux" then "linux-arm-thr" else
if stdenv.system == "armv7l-linux" then "linux-arm-thr" else
if stdenv.system == "x86_64-darwin" then "macosx-thr" else
if stdenv.system == "i686-darwin" then "macosx-64-thr" else
if stdenv.system == "i686-cygwin" then "win32" else

View File

@ -2,9 +2,11 @@
, fetchPypi
, buildPythonPackage
, cython
, sphinx
, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
}:
assert pariSupport -> pari != null;
buildPythonPackage rec {
pname = "cysignals";
version = "1.7.1";
@ -14,6 +16,8 @@ buildPythonPackage rec {
sha256 = "15nky8siwlc7s8v23vv4m0mnxa1z6jcs2qfr26m2mkw9j9g2na2j";
};
# explicit check:
# build/src/cysignals/implementation.c:27:2: error: #error "cysignals must be compiled without _FORTIFY_SOURCE"
hardeningDisable = [
"fortify"
];
@ -26,6 +30,10 @@ buildPythonPackage rec {
export PATH="$out/bin:$PATH"
'';
buildInputs = lib.optionals pariSupport [
pari
];
propagatedBuildInputs = [
cython
];

View File

@ -1,7 +1,6 @@
{ stdenv
, buildPythonPackage
, fetchpatch
, fetchPypi
, fetchFromGitHub
, flask
, flask-silk
, future
@ -9,11 +8,16 @@
buildPythonPackage rec {
pname = "Flask-AutoIndex";
version = "0.6";
version = "2018-06-28";
src = fetchPypi {
inherit pname version;
sha256 = "19b10mb1nrqfjyafki6wnrbn8mqi30bbyyiyvp5xssc74pciyfqs";
# master fixes various issues (binary generation, flask syntax) and has no
# major changes
# new release requested: https://github.com/sublee/flask-autoindex/issues/38
src = fetchFromGitHub {
owner = "sublee";
repo = "flask-autoindex";
rev = "e3d449a89d56bf4c171c7c8d90af028e579782cf";
sha256 = "0bwq2nid4h8vrxspggk064vra4wd804cl2ryyx4j2d1dyywmgjgy";
};
propagatedBuildInputs = [
@ -22,15 +26,6 @@ buildPythonPackage rec {
future
];
patches = [
# fix generated binary, see https://github.com/sublee/flask-autoindex/pull/32
(fetchpatch {
name = "fix_binary.patch";
url = "https://github.com/sublee/flask-autoindex/pull/32.patch";
sha256 = "1v2r0wvi7prhipjq89774svv6aqj0a13mdfj07pdlkpzfbf029dn";
})
];
meta = with stdenv.lib; {
description = "The mod_autoindex for Flask";
longDescription = ''

View File

@ -1,16 +1,20 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, fetchFromGitHub
, flask
}:
buildPythonPackage rec {
pname = "Flask-Silk";
version = "0.2";
version = "2018-06-28";
src = fetchPypi {
inherit pname version;
sha256 = "1gjzighx4f0w39sq9xvzr1kwb4y7yv9qrgzvli1p89gy16piz8l0";
# master fixes flask import syntax and has no major changes
# new release requested: https://github.com/sublee/flask-silk/pull/6
src = fetchFromGitHub {
owner = "sublee";
repo = "flask-silk";
rev = "3a8166550f9a0ec52edae7bf31d9818c4c15c531";
sha256 = "0mplziqw52jfspas6vsm210lmxqqzgj0dxm8y0i3gpbyyykwcmh0";
};
propagatedBuildInputs = [

View File

@ -1,6 +1,7 @@
{ lib
, buildPythonPackage
, fetchPypi
, fetchpatch
, glibcLocales
, mpmath
}:
@ -25,10 +26,26 @@ buildPythonPackage rec {
export LANG="en_US.UTF-8"
'';
patches = [
# see https://trac.sagemath.org/ticket/20204 and https://github.com/sympy/sympy/issues/12825
# There is also an upstream patch for this, included in the next release (PR #128826).
# However that doesn't quite fix the issue yet. Apparently some changes by sage are required.
# TODO re-evaluate the change once a new sympy version is released (open a sage trac ticket about
# it).
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/sympy/patches/03_undeffun_sage.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "1mh2va1rlgizgvx8yzqwgvbf5wvswarn511002b361mc8yy0bnhr";
})
(fetchpatch {
url = "https://github.com/sympy/sympy/pull/13276.patch";
sha256 = "1rz74b5c74vwh3pj9axxgh610i02l3555vvsvr4a15ya7siw7zxh";
})
];
meta = {
description = "A Python library for symbolic mathematics";
homepage = http://www.sympy.org/;
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ lovek323 ];
};
}
}

View File

@ -10099,6 +10099,24 @@ with pkgs;
libgadu = callPackage ../development/libraries/libgadu { };
gap-libgap-compatible = let
version = "4r8p6";
pkgVer = "2016_11_12-14_25";
in
(gap.override { keepAllPackages = false; }).overrideAttrs (oldAttrs: {
name = "libgap-${oldAttrs.pname}-${version}";
src = fetchurl {
url = "https://www.gap-system.org/pub/gap/gap48/tar.bz2/gap${version}_${pkgVer}.tar.bz2";
sha256 = "19n2p1mdg33s2x9rs51iak7rgndc1cwr56jyqnah0g1ydgg1yh6b";
};
patches = (oldAttrs.patches or []) ++ [
# don't install any packages by default (needed for interop with libgap, probably obsolete with 4r10
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/gap/patches/nodefaultpackages.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "1xwj766m3axrxbkyx13hy3q8s2wkqxy3m6mgpwq3c3n4vk3v416v";
})
];
});
libgap = callPackage ../development/libraries/libgap { };
libgdata = gnome3.libgdata;
@ -14586,18 +14604,26 @@ with pkgs;
camingo-code = callPackage ../data/fonts/camingo-code { };
combinatorial_designs = callPackage ../data/misc/combinatorial_designs { };
conway_polynomials = callPackage ../data/misc/conway_polynomials { };
dosis = callPackage ../data/fonts/dosis { };
dosemu_fonts = callPackage ../data/fonts/dosemu-fonts { };
eb-garamond = callPackage ../data/fonts/eb-garamond { };
elliptic_curves = callPackage ../data/misc/elliptic_curves { };
faba-icon-theme = callPackage ../data/icons/faba-icon-theme { };
faba-mono-icons = callPackage ../data/icons/faba-mono-icons { };
fixedsys-excelsior = callPackage ../data/fonts/fixedsys-excelsior { };
graphs = callPackage ../data/misc/graphs { };
emacs-all-the-icons-fonts = callPackage ../data/fonts/emacs-all-the-icons-fonts { };
emojione = callPackage ../data/fonts/emojione {
@ -14802,8 +14828,14 @@ with pkgs;
paratype-pt-sans = callPackage ../data/fonts/paratype-pt/sans.nix {};
paratype-pt-serif = callPackage ../data/fonts/paratype-pt/serif.nix {};
pari-galdata = callPackage ../data/misc/pari-galdata {};
pari-seadata-small = callPackage ../data/misc/pari-seadata-small {};
poly = callPackage ../data/fonts/poly { };
polytopes_db = callPackage ../data/misc/polytopes_db { };
posix_man_pages = callPackage ../data/documentation/man-pages-posix { };
powerline-fonts = callPackage ../data/fonts/powerline-fonts { };
@ -20351,7 +20383,10 @@ with pkgs;
petsc = callPackage ../development/libraries/science/math/petsc { };
sage = callPackage ../applications/science/math/sage { };
sage = callPackage ../applications/science/math/sage {
nixpkgs = pkgs;
};
sageWithDoc = sage.override { withDoc = true; };
suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { };
suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {};