diff options
author | Antonio Rojas | 2019-10-05 08:55:49 +0000 |
---|---|---|
committer | Antonio Rojas | 2019-10-05 08:55:49 +0000 |
commit | 4c366b0304670d00a4a77dee24a1328709859c0a (patch) | |
tree | e0a48bff71c70fa7c7c94e4bc1673cc3e153f38d | |
parent | d08962ad1bdcae055338b6591ccae5d86c6fd007 (diff) | |
download | aur-4c366b0304670d00a4a77dee24a1328709859c0a.tar.gz |
Switch to python 3
-rw-r--r-- | .SRCINFO | 90 | ||||
-rw-r--r-- | PKGBUILD | 78 | ||||
-rw-r--r-- | sagemath-cremona.patch | 4 | ||||
-rw-r--r-- | sagemath-ipython7.patch | 371 | ||||
-rw-r--r-- | sagemath-mathjax-dir.patch | 27 | ||||
-rw-r--r-- | sagemath-python3-notebook.patch | 18 | ||||
-rw-r--r-- | sagemath-rpy-3.patch | 79 |
7 files changed, 567 insertions, 100 deletions
@@ -1,26 +1,26 @@ pkgbase = sagemath-git - pkgdesc = Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab - pkgver = 8.9.beta8.r0.g4583b4056e + pkgdesc = Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab (experimental Python 3 version) + pkgver = 9.0.beta0.r0.g533fd5d6cd pkgrel = 1 url = http://www.sagemath.org arch = x86_64 license = GPL - makedepends = cython2 + makedepends = cython makedepends = boost makedepends = ratpoints - makedepends = python2-jinja + makedepends = python-jinja makedepends = coin-or-cbc makedepends = sirocco makedepends = mcqd makedepends = coxeter makedepends = bliss makedepends = tdlib - makedepends = python2-pkgconfig + makedepends = python-pkgconfig makedepends = shared_meataxe makedepends = libfes makedepends = primecount makedepends = git - depends = ipython2 + depends = ipython depends = palp depends = brial depends = cliquer @@ -28,17 +28,18 @@ pkgbase = sagemath-git depends = gfan depends = sympow depends = nauty - depends = python2-rpy2 - depends = python2-fpylll - depends = python2-psutil - depends = python2-cypari2 - depends = python2-matplotlib - depends = python2-scipy - depends = python2-sympy - depends = python2-networkx - depends = python2-pillow - depends = python2-pplpy - depends = python2-future + depends = python-rpy2 + depends = python-fpylll + depends = python-psutil + depends = python-cypari2 + depends = python-matplotlib + depends = python-scipy + depends = python-sympy + depends = python-networkx + depends = python-pillow + depends = python-pplpy + depends = python-future + depends = python-sphinx depends = gap depends = flintqs depends = lcalc @@ -47,8 +48,8 @@ pkgbase = sagemath-git depends = eclib depends = zn_poly depends = gd - depends = python2-cvxopt - depends = pynac + depends = python-cvxopt + depends = pynac-python3 depends = linbox depends = m4rie depends = rubiks @@ -68,12 +69,11 @@ pkgbase = sagemath-git depends = libbraiding depends = symmetrica depends = three.js - optdepends = cython2: to compile cython code - optdepends = python2-pkgconfig: to compile cython code - optdepends = jmol: 3D plots - optdepends = sage-notebook: Flask notebook interface (deprecated) + optdepends = cython: to compile cython code + optdepends = python-pkgconfig: to compile cython code + optdepends = jmol: alternative 3D plot engine optdepends = sagemath-doc: HTML documentation - optdepends = python2-igraph: igraph backend for graph theory + optdepends = python-igraph: igraph backend for graph theory optdepends = coin-or-cbc: COIN backend for numerical computations optdepends = coin-or-csdp: for computing Lovász theta-function of graphs optdepends = buckygen: for generating fullerene graphs @@ -84,43 +84,46 @@ pkgbase = sagemath-git optdepends = coxeter: Coxeter groups implementation optdepends = lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes optdepends = libfes: exhaustive search of solutions for boolean equations - optdepends = python2-pynormaliz: Normaliz backend for polyhedral computations + optdepends = python-pynormaliz: Normaliz backend for polyhedral computations optdepends = latte-integrale: integral point count in polyhedra - optdepends = python2-jupymake: polymake backend for polyhedral computations + optdepends = python-jupymake: polymake backend for polyhedral computations optdepends = shared_meataxe: faster matrix arithmetic over finite fields optdepends = openblas: faster linear algebra optdepends = sirocco: for computing the fundamental group of the complement of a plane curve optdepends = primecount: faster prime_pi implementation optdepends = dot2tex: for displaying some diagrams optdepends = cryptominisat5: SAT solver - optdepends = python2-pycosat: picosat SAT solver - optdepends = python2-pip: to install optional packages with sage -pip + optdepends = python-pycosat: picosat SAT solver + optdepends = python-pip: to install optional packages with sage -pip source = git://git.sagemath.org/sage.git#branch=develop source = package.patch source = latte-count.patch - source = sagemath-python3-notebook.patch source = test-optional.patch source = fes02.patch source = sagemath-cremona.patch source = sagemath-singular-4.1.2.patch source = sagemath-ecl-sigfpe.patch + source = sagemath-ipython7.patch + source = sagemath-rpy-3.patch + source = sagemath-mathjax-dir.patch sha256sums = SKIP sha256sums = 328e45e78065b5f6527174bda48cfff6828acbf107c2535b0a9a92c3ceb35842 sha256sums = 1a82372a96ffd5e6d475b0e620935967ce5eb9b4484607d39da90824a77b07c4 - sha256sums = e554cdf689100c787a5fbcb7fe281cd68bef081e08bd58df8be1d113a4665d7e sha256sums = 1f2a34e15bf732ec8687c467a52e897615505dc3ddd792d811e8b6a7e19f1517 sha256sums = 7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94 - sha256sums = 5281e5c715ff14ffa4003f643a508863ca58efb9e083cece81928f78810dc525 + sha256sums = 937074fa7a8a4e2aba9ea77ec622fe937985a1a9176c48460d51325ee877a4f5 sha256sums = 961bfb5694b67d425d21240d71490cb71714b5207c23448c89be0966512ff8f9 sha256sums = a42f3b152b1aedb8abf16bc70971419919d1fe30328574e7fef8305f9d07d938 + sha256sums = 1336f8ce3ef2fbc7531da90b60b83cf8b7713cbf726cff6fdbbd30f085c31074 + sha256sums = 9062b412595e81a5ca560a5ae789f8b7318981689cb8d076b30d8c54a4fc4495 + sha256sums = 388cd321fb8b73ae839bf2c150f7dd26ba34b0f6845f9761184db1dd5086b697 pkgname = sagemath-git - optdepends = cython2: to compile cython code - optdepends = python2-pkgconfig: to compile cython code - optdepends = jmol: 3D plots - optdepends = sage-notebook: Flask notebook interface (deprecated) + optdepends = cython: to compile cython code + optdepends = python-pkgconfig: to compile cython code + optdepends = jmol: alternative 3D plot engine optdepends = sagemath-doc: HTML documentation - optdepends = python2-igraph: igraph backend for graph theory + optdepends = python-igraph: igraph backend for graph theory optdepends = coin-or-cbc: COIN backend for numerical computations optdepends = coin-or-csdp: for computing Lovász theta-function of graphs optdepends = buckygen: for generating fullerene graphs @@ -131,26 +134,25 @@ pkgname = sagemath-git optdepends = coxeter: Coxeter groups implementation optdepends = lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes optdepends = libfes: exhaustive search of solutions for boolean equations - optdepends = python2-pynormaliz: Normaliz backend for polyhedral computations + optdepends = python-pynormaliz: Normaliz backend for polyhedral computations optdepends = latte-integrale: integral point count in polyhedra - optdepends = python2-jupymake: polymake backend for polyhedral computations + optdepends = python-jupymake: polymake backend for polyhedral computations optdepends = shared_meataxe: faster matrix arithmetic over finite fields optdepends = openblas: faster linear algebra optdepends = sirocco: for computing the fundamental group of the complement of a plane curve optdepends = primecount: faster prime_pi implementation optdepends = dot2tex: for displaying some diagrams optdepends = cryptominisat5: SAT solver - optdepends = python2-pycosat: picosat SAT solver - optdepends = python2-pip: to install optional packages with sage -pip - optdepends = sagemath-jupyter: Jupyter kernel + optdepends = python-pycosat: picosat SAT solver + optdepends = python-pip: to install optional packages with sage -pip + optdepends = sagemath-jupyter-git: Jupyter kernel provides = sagemath conflicts = sagemath pkgname = sagemath-jupyter-git pkgdesc = Jupyter kernel for SageMath depends = sagemath - depends = python2-jupyter_client - depends = python2-ipywidgets + depends = python-jupyter_client + depends = python-ipywidgets depends = jsmol - optdepends = sage-notebook-exporter: convert flask notebooks to Jupyter @@ -7,51 +7,54 @@ pkgbase=sagemath-git pkgname=(sagemath-git sagemath-jupyter-git) -pkgver=8.9.beta8.r0.g4583b4056e +pkgver=9.0.beta0.r0.g533fd5d6cd pkgrel=1 -pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab" +pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab (experimental Python 3 version)" arch=(x86_64) url="http://www.sagemath.org" license=(GPL) -depends=(ipython2 palp brial cliquer maxima-ecl gfan sympow nauty python2-rpy2 python2-fpylll python2-psutil python2-cypari2 - python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-pplpy python2-future - gap flintqs lcalc lrcalc arb eclib zn_poly gd python2-cvxopt pynac linbox m4rie rubiks pari-galdata pari-seadata-small planarity rankwidth tachyon +depends=(ipython palp brial cliquer maxima-ecl gfan sympow nauty python-rpy2 python-fpylll python-psutil python-cypari2 + python-matplotlib python-scipy python-sympy python-networkx python-pillow python-pplpy python-future python-sphinx + gap flintqs lcalc lrcalc arb eclib zn_poly gd python-cvxopt pynac-python3 linbox m4rie rubiks pari-galdata pari-seadata-small planarity rankwidth tachyon sage-data-combinatorial_designs sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sage-data-conway_polynomials iml libgiac libhomfly libbraiding symmetrica three.js) -optdepends=('cython2: to compile cython code' 'python2-pkgconfig: to compile cython code' - 'jmol: 3D plots' 'sage-notebook: Flask notebook interface (deprecated)' - 'sagemath-doc: HTML documentation' 'python2-igraph: igraph backend for graph theory' +optdepends=('cython: to compile cython code' 'python-pkgconfig: to compile cython code' + 'jmol: alternative 3D plot engine' 'sagemath-doc: HTML documentation' 'python-igraph: igraph backend for graph theory' 'coin-or-cbc: COIN backend for numerical computations' 'coin-or-csdp: for computing Lovász theta-function of graphs' 'buckygen: for generating fullerene graphs' 'plantri: for generating some classes of graphs' 'benzene: for generating fusenes and benzenoids' 'ffmpeg: to export animations to video' 'imagemagick: to show animations' 'coxeter: Coxeter groups implementation' 'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes' - 'libfes: exhaustive search of solutions for boolean equations' 'python2-pynormaliz: Normaliz backend for polyhedral computations' - 'latte-integrale: integral point count in polyhedra' 'python2-jupymake: polymake backend for polyhedral computations' + 'libfes: exhaustive search of solutions for boolean equations' 'python-pynormaliz: Normaliz backend for polyhedral computations' + 'latte-integrale: integral point count in polyhedra' 'python-jupymake: polymake backend for polyhedral computations' 'shared_meataxe: faster matrix arithmetic over finite fields' 'openblas: faster linear algebra' 'sirocco: for computing the fundamental group of the complement of a plane curve' 'primecount: faster prime_pi implementation' - 'dot2tex: for displaying some diagrams' 'cryptominisat5: SAT solver' 'python2-pycosat: picosat SAT solver' - 'python2-pip: to install optional packages with sage -pip') -makedepends=(cython2 boost ratpoints python2-jinja coin-or-cbc sirocco - mcqd coxeter bliss tdlib python2-pkgconfig shared_meataxe libfes primecount git) + 'dot2tex: for displaying some diagrams' 'cryptominisat5: SAT solver' 'python-pycosat: picosat SAT solver' + 'python-pip: to install optional packages with sage -pip') +makedepends=(cython boost ratpoints python-jinja coin-or-cbc sirocco + mcqd coxeter bliss tdlib python-pkgconfig shared_meataxe libfes primecount git) source=(git://git.sagemath.org/sage.git#branch=develop package.patch latte-count.patch - sagemath-python3-notebook.patch test-optional.patch fes02.patch sagemath-cremona.patch sagemath-singular-4.1.2.patch - sagemath-ecl-sigfpe.patch) + sagemath-ecl-sigfpe.patch + sagemath-ipython7.patch + sagemath-rpy-3.patch + sagemath-mathjax-dir.patch) sha256sums=('SKIP' '328e45e78065b5f6527174bda48cfff6828acbf107c2535b0a9a92c3ceb35842' '1a82372a96ffd5e6d475b0e620935967ce5eb9b4484607d39da90824a77b07c4' - 'e554cdf689100c787a5fbcb7fe281cd68bef081e08bd58df8be1d113a4665d7e' '1f2a34e15bf732ec8687c467a52e897615505dc3ddd792d811e8b6a7e19f1517' '7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94' - '5281e5c715ff14ffa4003f643a508863ca58efb9e083cece81928f78810dc525' + '937074fa7a8a4e2aba9ea77ec622fe937985a1a9176c48460d51325ee877a4f5' '961bfb5694b67d425d21240d71490cb71714b5207c23448c89be0966512ff8f9' - 'a42f3b152b1aedb8abf16bc70971419919d1fe30328574e7fef8305f9d07d938') + 'a42f3b152b1aedb8abf16bc70971419919d1fe30328574e7fef8305f9d07d938' + '1336f8ce3ef2fbc7531da90b60b83cf8b7713cbf726cff6fdbbd30f085c31074' + '9062b412595e81a5ca560a5ae789f8b7318981689cb8d076b30d8c54a4fc4495' + '388cd321fb8b73ae839bf2c150f7dd26ba34b0f6845f9761184db1dd5086b697') pkgver() { cd sage @@ -68,8 +71,10 @@ prepare(){ patch -p0 -i ../test-optional.patch # use correct latte-count binary name patch -p1 -i ../latte-count.patch -# make 'sage -notebook=jupyter' work with our python3 jupyter-notebook package - patch -p1 -i ../sagemath-python3-notebook.patch +# Support IPython 7 + patch -p1 -i ../sagemath-ipython7.patch +# Adapt to rpy 3.0 changes + patch -p1 -i ../sagemath-rpy-3.patch # Upstream patches # fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209 @@ -80,11 +85,11 @@ prepare(){ patch -p1 -i ../sagemath-singular-4.1.2.patch # Fix SIGFPE crashes with ecl 16.1.3 https://trac.sagemath.org/ticket/22191 patch -p1 -i ../sagemath-ecl-sigfpe.patch +# Don't hardcode mathjax path https://trac.sagemath.org/ticket/28547 + patch -p1 -i ../sagemath-mathjax-dir.patch -# use python2 - sed -e 's|sage-python23|python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' -i src/bin/* - sed -e 's|exec ipython\b|exec ipython2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage - sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython + sed -e 's|sage-python23|python|' -i src/bin/* + sed -e 's|$SAGE_PYTHON3|yes|' -i src/bin/sage } build() { @@ -94,11 +99,11 @@ build() { SAGE_ROOT="$PWD" \ SAGE_SRC="$PWD" \ SAGE_NUM_THREADS=10 - python2 setup.py build + python setup.py build } package_sagemath-git() { - optdepends+=('sagemath-jupyter: Jupyter kernel') + optdepends+=('sagemath-jupyter-git: Jupyter kernel') conflicts=(sagemath) provides=(sagemath) @@ -107,7 +112,8 @@ package_sagemath-git() { export SAGE_ROOT="$PWD" \ SAGE_LOCAL="/usr" \ SAGE_EXTCODE="$PWD"/ext - python2 setup.py install --root="$pkgdir" --optimize=1 + + python setup.py install --root="$pkgdir" --optimize=1 mkdir -p "$pkgdir"/usr/bin cp bin/{sage,math-readline} "$pkgdir"/usr/bin @@ -121,11 +127,12 @@ package_sagemath-git() { mkdir -p "$pkgdir"/usr/share/sage cp -r ext "$pkgdir"/usr/share/sage + _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"` # Remove sage_setup - rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup + rm -r "$pkgdir"/$_pythonpath/sage_setup # Install tests - cp -r sage/doctest/tests "$pkgdir"/usr/lib/python2.7/site-packages/sage/doctest - cp -r sage/tests/books "$pkgdir"/usr/lib/python2.7/site-packages/sage/tests + cp -r sage/doctest/tests "$pkgdir"/$_pythonpath/sage/doctest + cp -r sage/tests/books "$pkgdir"/$_pythonpath/sage/tests # Split jupyter kernel rm -r "$pkgdir"/usr/share/jupyter @@ -133,15 +140,14 @@ package_sagemath-git() { package_sagemath-jupyter-git() { pkgdesc='Jupyter kernel for SageMath' - depends=(sagemath python2-jupyter_client python2-ipywidgets jsmol) - optdepends=('sage-notebook-exporter: convert flask notebooks to Jupyter') + depends=(sagemath python-jupyter_client python-ipywidgets jsmol) cd sage/src export SAGE_ROOT="$PWD" \ - SAGE_LOCAL="/usr" - python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update(prefix='$pkgdir/usr')" - + SAGE_LOCAL="/usr" \ + MATHJAX_DIR="/usr/share/mathjax2" + python -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update(prefix='$pkgdir/usr')" # fix symlinks to assets for _i in $(ls ext/notebook-ipython); do rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i diff --git a/sagemath-cremona.patch b/sagemath-cremona.patch index 7765a14b5079..27328953a4bf 100644 --- a/sagemath-cremona.patch +++ b/sagemath-cremona.patch @@ -11,7 +11,7 @@ index 3f8dd62..ed5726a 100644 from sage.env import CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR, SAGE_SHARE from sage.misc.all import walltime -@@ -843,7 +843,7 @@ class MiniCremonaDatabase(SQLDatabase): +@@ -847,7 +847,7 @@ class MiniCremonaDatabase(SQLDatabase): if N < self.largest_conductor(): message = "There is no elliptic curve with label " + label \ + " in the database" @@ -20,7 +20,7 @@ index 3f8dd62..ed5726a 100644 message = "There is no elliptic curve with label " + label \ + " in the currently available databases" else: -@@ -1695,7 +1695,7 @@ def CremonaDatabase(name=None,mini=None,set_global=None): +@@ -1705,7 +1705,7 @@ def CremonaDatabase(name=None,mini=None,set_global=None): if name is None and not set_global: return _db if set_global and name is None: diff --git a/sagemath-ipython7.patch b/sagemath-ipython7.patch new file mode 100644 index 000000000000..33f4b6cafed1 --- /dev/null +++ b/sagemath-ipython7.patch @@ -0,0 +1,371 @@ +diff --git a/src/sage/combinat/combinatorial_map.py b/src/sage/combinat/combinatorial_map.py +index 03075615bd..0be1240a94 100644 +--- a/src/sage/combinat/combinatorial_map.py ++++ b/src/sage/combinat/combinatorial_map.py +@@ -257,8 +257,8 @@ class CombinatorialMap(object): + EXAMPLES:: + + sage: sage.combinat.combinatorial_map.combinatorial_map = sage.combinat.combinatorial_map.combinatorial_map_wrapper +- sage: import imp +- sage: _ = imp.reload(sage.combinat.permutation) ++ sage: import importlib ++ sage: _ = importlib.reload(sage.combinat.permutation) + sage: p = Permutation([1,3,2,4]) + sage: p.left_tableau.__repr__() + 'Combinatorial map: Robinson-Schensted insertion tableau' +@@ -272,8 +272,8 @@ class CombinatorialMap(object): + EXAMPLES:: + + sage: sage.combinat.combinatorial_map.combinatorial_map = sage.combinat.combinatorial_map.combinatorial_map_wrapper +- sage: import imp +- sage: _ = imp.reload(sage.combinat.permutation) ++ sage: import importlib ++ sage: _ = importlib.reload(sage.combinat.permutation) + sage: p = Permutation([1,3,2,4]) + sage: cm = p.left_tableau; cm + Combinatorial map: Robinson-Schensted insertion tableau +@@ -293,8 +293,8 @@ class CombinatorialMap(object): + EXAMPLES:: + + sage: sage.combinat.combinatorial_map.combinatorial_map = sage.combinat.combinatorial_map.combinatorial_map_wrapper +- sage: import imp +- sage: _ = imp.reload(sage.combinat.permutation) ++ sage: import importlib ++ sage: _ = importlib.reload(sage.combinat.permutation) + sage: p = Permutation([1,3,2,4]) + sage: p.left_tableau #indirect doctest + Combinatorial map: Robinson-Schensted insertion tableau +@@ -309,8 +309,8 @@ class CombinatorialMap(object): + EXAMPLES:: + + sage: sage.combinat.combinatorial_map.combinatorial_map = sage.combinat.combinatorial_map.combinatorial_map_wrapper +- sage: import imp +- sage: _ = imp.reload(sage.combinat.permutation) ++ sage: import importlib ++ sage: _ = importlib.reload(sage.combinat.permutation) + sage: p = Permutation([1,3,2,4]) + sage: cm = type(p).left_tableau; cm + Combinatorial map: Robinson-Schensted insertion tableau +@@ -335,8 +335,8 @@ class CombinatorialMap(object): + EXAMPLES:: + + sage: sage.combinat.combinatorial_map.combinatorial_map = sage.combinat.combinatorial_map.combinatorial_map_wrapper +- sage: import imp +- sage: _ = imp.reload(sage.combinat.permutation) ++ sage: import importlib ++ sage: _ = importlib.reload(sage.combinat.permutation) + sage: from sage.combinat.permutation import Permutation + sage: pi = Permutation([1,3,2]) + sage: f = pi.reverse +@@ -400,8 +400,8 @@ def combinatorial_maps_in_class(cls): + EXAMPLES:: + + sage: sage.combinat.combinatorial_map.combinatorial_map = sage.combinat.combinatorial_map.combinatorial_map_wrapper +- sage: import imp +- sage: _ = imp.reload(sage.combinat.permutation) ++ sage: import importlib ++ sage: _ = importlib.reload(sage.combinat.permutation) + sage: from sage.combinat.combinatorial_map import combinatorial_maps_in_class + sage: p = Permutation([1,3,2,4]) + sage: cmaps = combinatorial_maps_in_class(p) +diff --git a/src/sage/parallel/use_fork.py b/src/sage/parallel/use_fork.py +index c3b5e59fe0..7c4207901b 100644 +--- a/src/sage/parallel/use_fork.py ++++ b/src/sage/parallel/use_fork.py +@@ -279,7 +279,7 @@ class p_iter_fork(object): + sage: F._subprocess(operator.add, tmp_dir(), (1, 2)) + sage: sys.stdout = saved_stdout + """ +- import imp, os, sys ++ import importlib, os, sys + from sage.misc.persist import save + + # Make it so all stdout is sent to a file so it can +@@ -291,7 +291,7 @@ class p_iter_fork(object): + # pid has changed (forcing a reload of + # misc). + import sage.misc.misc +- imp.reload(sage.misc.misc) ++ importlib.reload(sage.misc.misc) + + # The pexpect interfaces (and objects defined in them) are + # not valid. + +diff --git a/src/sage/all.py b/src/sage/all.py +index c87c9372e9..72db7b85bb 100644 +--- a/src/sage/all.py ++++ b/src/sage/all.py +@@ -19,7 +19,7 @@ We exclude the dependencies and check to see that there are no others + except for the known bad apples:: + + sage: allowed = [ +- ....: 'IPython', 'prompt_toolkit', # sage dependencies ++ ....: 'IPython', 'prompt_toolkit', 'jedi', # sage dependencies + ....: 'threading', 'multiprocessing', # doctest dependencies + ....: '__main__', 'sage.doctest', # doctesting + ....: 'signal', 'enum', # may appear in Python 3 +diff --git a/src/sage/repl/attach.py b/src/sage/repl/attach.py +index c350ec33af..4605951df2 100644 +--- a/src/sage/repl/attach.py ++++ b/src/sage/repl/attach.py +@@ -249,13 +249,13 @@ def reset_load_attach_path(): + sage: reset_load_attach_path(); load_attach_path() + ['.'] + sage: os.environ['SAGE_LOAD_ATTACH_PATH'] = '/veni/vidi:vici:' +- sage: import imp +- sage: imp.reload(sage.repl.attach) # Simulate startup ++ sage: import importlib ++ sage: importlib.reload(sage.repl.attach) # Simulate startup + <module 'sage.repl.attach' from '...'> + sage: load_attach_path() + ['.', '/veni/vidi', 'vici'] + sage: del os.environ['SAGE_LOAD_ATTACH_PATH'] +- sage: imp.reload(sage.repl.preparse) # Simulate startup ++ sage: importlib.reload(sage.repl.preparse) # Simulate startup + <module 'sage.repl.preparse' from '...'> + sage: reset_load_attach_path(); load_attach_path() + ['.'] +@@ -595,12 +595,7 @@ def reload_attached_files_if_modified(): + basename = os.path.basename(filename) + timestr = time.strftime('%T', mtime) + notice = '### reloading attached file {0} modified at {1} ###'.format(basename, timestr) +- if ip and ip.pt_cli: +- with ip.pt_cli.patch_stdout_context(raw=True): +- print(notice) +- code = load_wrap(filename, attach=True) +- ip.run_cell(code) +- elif ip: ++ if ip: + print(notice) + code = load_wrap(filename, attach=True) + ip.run_cell(code) +diff --git a/src/sage/repl/display/fancy_repr.py b/src/sage/repl/display/fancy_repr.py +index 818498fbae..af33f92126 100644 +--- a/src/sage/repl/display/fancy_repr.py ++++ b/src/sage/repl/display/fancy_repr.py +@@ -15,10 +15,12 @@ Representations of objects. + import types + + from IPython.lib.pretty import ( +- _safe_getattr, _baseclass_reprs, ++ _safe_getattr, + _type_pprinters, + ) + ++_baseclass_reprs = (object.__repr__,) ++ + from sage.repl.display.util import format_list + + +diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py +index 5c56e6bf89..a96c350791 100644 +--- a/src/sage/repl/interpreter.py ++++ b/src/sage/repl/interpreter.py +@@ -78,7 +78,7 @@ Check that Cython source code appears in tracebacks:: + dummy line + ... + ZeroDivisionError...Traceback (most recent call last) +- <ipython-input-...> in <module>() ++ <ipython-input-...> in <module>... + ----> 1 Integer(1)/Integer(0) + .../sage/rings/integer.pyx in sage.rings.integer.Integer...div... (.../cythonized/sage/rings/integer.c:...)() + ... +@@ -364,22 +364,19 @@ class SageTestShell(SageShellOverride, TerminalInteractiveShell): + ################################################################### + # Transformers used in the SageInputSplitter + ################################################################### +-from IPython.core.inputtransformer import (CoroutineInputTransformer, +- StatelessInputTransformer, +- _strip_prompts) ++from IPython.core.inputtransformer2 import PromptStripper + +-@StatelessInputTransformer.wrap +-def SagePreparseTransformer(line): ++def SagePreparseTransformer(lines): + r""" + EXAMPLES:: + + sage: from sage.repl.interpreter import SagePreparseTransformer +- sage: spt = SagePreparseTransformer() +- sage: spt.push('1+1r+2.3^2.3r') +- "Integer(1)+1+RealNumber('2.3')**2.3" ++ sage: spt = SagePreparseTransformer ++ sage: spt(['1+1r+2.3^2.3r']) ++ ["Integer(1)+1+RealNumber('2.3')**2.3"] + sage: preparser(False) +- sage: spt.push('2.3^2') +- '2.3^2' ++ sage: spt(['2.3^2']) ++ ['2.3^2'] + + TESTS: + +@@ -400,57 +397,15 @@ def SagePreparseTransformer(line): + <BLANKLINE> + sage: shell.quit() + """ +- if _do_preparse and not line.startswith('%'): +- return preparse(line) +- else: +- return line +- +-@CoroutineInputTransformer.wrap +-def SagePromptTransformer(): +- r""" +- Strip the sage:/....: prompts of Sage. +- +- EXAMPLES:: +- +- sage: from sage.repl.interpreter import SagePromptTransformer +- sage: spt = SagePromptTransformer() +- sage: spt.push("sage: 2 + 2") +- '2 + 2' +- sage: spt.push('') +- '' +- sage: spt.push("....: 2+2") +- '2+2' +- +- This should strip multiple prompts: see :trac:`16297`:: +- +- sage: spt.push("sage: sage: 2+2") +- '2+2' +- sage: spt.push(" sage: ....: 2+2") +- '2+2' +- +- The prompt contains a trailing space. Extra spaces between the +- last prompt and the remainder should not be stripped:: +- +- sage: spt.push(" sage: ....: 2+2") +- ' 2+2' +- +- We test that the input transformer is enabled on the Sage command +- line:: +- +- sage: from sage.repl.interpreter import get_test_shell +- sage: shell = get_test_shell() +- sage: shell.run_cell('sage: a = 123') # single line +- sage: shell.run_cell('sage: a = [\n... 123]') # old-style multi-line +- sage: shell.run_cell('sage: a = [\n....: 123]') # new-style multi-line +- +- We test that :trac:`16196` is resolved:: ++ lines_out = [] ++ for line in lines: ++ if _do_preparse and not line.startswith('%'): ++ lines_out += [preparse(line)] ++ else: ++ lines_out += [line] ++ return lines_out + +- sage: shell.run_cell(' sage: 1+1') +- 2 +- sage: shell.quit() +- """ +- _sage_prompt_re = re.compile(r'^(\s*(:?sage: |\.\.\.\.: ))+') +- return _strip_prompts(_sage_prompt_re) ++SagePromptTransformer = PromptStripper(prompt_re=re.compile(r'^(\s*(:?sage: |\.\.\.\.: ))+')) + + ################### + # Interface shell # +@@ -612,7 +567,7 @@ def interface_shell_embed(interface): + sage: shell = interface_shell_embed(gap) + sage: shell.run_cell('List( [1..10], IsPrime )') + [ false, true, true, false, true, false, true, false, false, false ] +- <ExecutionResult object at ..., execution_count=None error_before_exec=None error_in_exec=None result=[ false, true, true, false, true, false, true, false, false, false ]> ++ <ExecutionResult object at ..., execution_count=None error_before_exec=None error_in_exec=None ...result=[ false, true, true, false, true, false, true, false, false, false ]> + """ + cfg = sage_ipython_config.copy() + ipshell = InteractiveShellEmbed(config=cfg, +diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py +index 21d21afd3d..0c58dd1d26 100644 +--- a/src/sage/repl/ipython_extension.py ++++ b/src/sage/repl/ipython_extension.py +@@ -509,10 +509,8 @@ class SageCustomizations(object): + from .interpreter import (SagePreparseTransformer, + SagePromptTransformer) + +- for s in (self.shell.input_splitter, self.shell.input_transformer_manager): +- s.physical_line_transforms.insert(1, SagePromptTransformer()) +- s.python_line_transforms.append(SagePreparseTransformer()) +- ++ self.shell.input_transformers_cleanup.insert(1, SagePromptTransformer) ++ self.shell.input_transformers_post.append(SagePreparseTransformer) + + class SageJupyterCustomizations(SageCustomizations): + @staticmethod +diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py +index 0dc5e1f4cc..afb3396755 100644 +--- a/src/sage/rings/qqbar.py ++++ b/src/sage/rings/qqbar.py +@@ -7748,13 +7748,13 @@ class ANBinaryExpr(ANDescr): + decrease it before we return:: + + sage: import sys; sys.getrecursionlimit() +- 1000 ++ 3000 + sage: s = SymmetricFunctions(QQ).schur() + sage: a=s([3,2]).expand(8)(flatten([[QQbar.zeta(3)^d for d in range(3)], [QQbar.zeta(5)^d for d in range(5)]])) + sage: a.exactify(); a # long time + 0 + sage: sys.getrecursionlimit() +- 1000 ++ 3000 + + """ + import sys +diff --git a/src/sage/repl/interface_magic.py b/src/sage/repl/interface_magic.py +index a2b9988315..15da4c0bab 100644 +--- a/src/sage/repl/interface_magic.py ++++ b/src/sage/repl/interface_magic.py +@@ -260,7 +260,7 @@ class InterfaceMagic(object): + 2 + 120 + sage: shell.run_cell('%%gap foo\n1+1;\n') +- File "<string>", line unknown ++ ...File "<string>", line unknown + SyntaxError: Interface magics have no options, got "foo" + <BLANKLINE> + sage: shell.run_cell('%%gap?') +diff --git a/src/sage/repl/ipython_tests.py b/src/sage/repl/ipython_tests.py +index d342ba7fac..ab9504337e 100644 +--- a/src/sage/repl/ipython_tests.py ++++ b/src/sage/repl/ipython_tests.py +@@ -42,6 +42,7 @@ Next, test the pinfo magic for Cython code:: + Init docstring: ...ee help(type(...)) for...signature... + File: .../sage/tests/stl_vector.pyx + Type: type ++ ... + + Next, test the ``pinfo`` magic for ``R`` interface code, see :trac:`26906`:: + +@@ -67,6 +68,7 @@ calls when you ask for the double-questionmark help, like `foo??` :: + sage: shell.run_cell(u'from sage.repl.ipython_tests import dummy') + sage: shell.run_cell(u'%pinfo2 dummy') + Signature: dummy(argument, optional=None) ++ ... + Source: + def dummy(argument, optional=None): + """ +@@ -116,6 +118,7 @@ Next, test the pinfo2 magic for Cython code:: + ... + File: .../sage/tests/stl_vector.pyx + Type: type ++ ... + + Next, test the ``pinfo2`` magic for ``R`` interface code, see :trac:`26906`:: + +diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py +index 5ffdb3d374..0d28873e2a 100644 +--- a/src/sage/repl/display/formatter.py ++++ b/src/sage/repl/display/formatter.py +@@ -173,8 +173,8 @@ class SageDisplayFormatter(DisplayFormatter): + sage: shell.run_cell('ipython_image') + <IPython.core.display.Image object> + sage: shell.run_cell('get_ipython().display_formatter.format(ipython_image)') +- ({u'image/png': ...'\x89PNG...', +- u'text/plain': u'<IPython.core.display.Image object>'}, ++ ({'image/png': ...', ++ 'text/plain': '<IPython.core.display.Image object>'}, + {}) + + Test that IPython images still work even in latex output mode:: + diff --git a/sagemath-mathjax-dir.patch b/sagemath-mathjax-dir.patch new file mode 100644 index 000000000000..f7f407fd9c7d --- /dev/null +++ b/sagemath-mathjax-dir.patch @@ -0,0 +1,27 @@ +diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py +index 401342da5b..12c418ad93 100644 +--- a/src/sage/docs/conf.py ++++ b/src/sage/docs/conf.py +@@ -1,5 +1,5 @@ + import sys, os, sphinx +-from sage.env import SAGE_DOC_SRC, SAGE_DOC, SAGE_SRC, THEBE_DIR, PPLPY_DOCS, SAGE_SHARE ++from sage.env import SAGE_DOC_SRC, SAGE_DOC, SAGE_SRC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR + import sage.version + from sage.misc.sagedoc import extlinks + import dateutil.parser +@@ -260,13 +260,12 @@ if (os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'no' + from sage.misc.latex_macros import sage_mathjax_macros + html_theme_options['mathjax_macros'] = sage_mathjax_macros() + +- mathjax_relative = 'mathjax' ++ mathjax_relative = os.path.basename(MATHJAX_DIR) + + # It would be really nice if sphinx would copy the entire mathjax directory, + # (so we could have a _static/mathjax directory), rather than the contents of the directory + +- mathjax_static = os.path.join(SAGE_SHARE, mathjax_relative) +- html_static_path.append(mathjax_static) ++ html_static_path.append(MATHJAX_DIR) + exclude_patterns += ['**/'+os.path.join(mathjax_relative, i) + for i in ('docs', 'README*', 'test', + 'unpacked', 'LICENSE')] diff --git a/sagemath-python3-notebook.patch b/sagemath-python3-notebook.patch deleted file mode 100644 index 9ca667817848..000000000000 --- a/sagemath-python3-notebook.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/src/bin/sage-notebook b/src/bin/sage-notebook -index 74192da240..0ede281aad 100755 ---- a/src/bin/sage-notebook -+++ b/src/bin/sage-notebook -@@ -91,12 +91,7 @@ class NotebookJupyter(object): - - def __init__(self, argv): - self.print_banner() -- from sage.repl.ipython_kernel.install import have_prerequisites -- if not have_prerequisites(): -- print(self.PREREQUISITE_ERROR) -- raise SystemExit(1) -- from notebook.notebookapp import main -- main(argv) -+ os.execvp('jupyter-notebook', ['jupyter-notebook'] + argv) - - - class NotebookJupyterlab(object): diff --git a/sagemath-rpy-3.patch b/sagemath-rpy-3.patch new file mode 100644 index 000000000000..3b192db4c6c7 --- /dev/null +++ b/sagemath-rpy-3.patch @@ -0,0 +1,79 @@ +diff --git a/src/sage/interfaces/r.py b/src/sage/interfaces/r.py +index ad4f3bfd8a..3c1c0bb369 100644 +--- a/src/sage/interfaces/r.py ++++ b/src/sage/interfaces/r.py +@@ -373,7 +373,7 @@ def _setup_r_to_sage_converter(): + cv = Converter('r to sage converter') + + # fallback +- cv.ri2py.register(object, lambda obj: obj) ++ cv.rpy2py.register(object, lambda obj: obj) + + def float_to_int_if_possible(f): + # First, round the float to at most 15 significant places. +@@ -383,7 +383,7 @@ def _setup_r_to_sage_converter(): + # Preserve the behaviour of the old r parser, e.g. return 1 instead of 1.0 + float_or_int = int(f) if isinstance(f, int) or f.is_integer() else f + return float_or_int +- cv.ri2py.register(float, float_to_int_if_possible) ++ cv.rpy2py.register(float, float_to_int_if_possible) + + def list_to_singleton_if_possible(l): + if len(l) == 1: +@@ -395,11 +395,11 @@ def _setup_r_to_sage_converter(): + attrs = vec.list_attrs() + # Recursive calls have to be made explicitly + # https://bitbucket.org/rpy2/rpy2/issues/363/custom-converters-are-not-applied +- data = list_to_singleton_if_possible([ cv.ri2py(val) for val in vec ]) ++ data = list_to_singleton_if_possible([ cv.rpy2py(val) for val in vec ]) + rclass = list(vec.do_slot('class')) if 'class' in attrs else vec.rclass + + if 'names' in attrs: +- # separate names and values, call ri2py recursively to convert elements ++ # separate names and values, call rpy2py recursively to convert elements + names = list_to_singleton_if_possible(list(vec.do_slot('names'))) + return { + 'DATA': data, +@@ -409,7 +409,7 @@ def _setup_r_to_sage_converter(): + else: + # if no names are present, convert to a normal list or a single value + return data +- cv.ri2py.register(SexpVector, _vector) ++ cv.rpy2py.register(SexpVector, _vector) + + def _matrix(mat): + if 'dim' in mat.list_attrs(): +@@ -421,28 +421,28 @@ def _setup_r_to_sage_converter(): + (nrow, ncol) = dimensions + # Since R does it the other way round, we assign transposed and + # then transpose the matrix :) +- m = matrix(ncol, nrow, [cv.ri2py(i) for i in mat]) ++ m = matrix(ncol, nrow, [cv.rpy2py(i) for i in mat]) + return m.transpose() + except TypeError: + pass + else: + return _vector(mat) +- cv.ri2py.register(FloatSexpVector, _matrix) ++ cv.rpy2py.register(FloatSexpVector, _matrix) + + def _list_vector(vec): + # we have a R list (vector of arbitrary elements) + attrs = vec.list_attrs() + names = vec.do_slot('names') +- values = [ cv.ri2py(val) for val in vec ] ++ values = [ cv.rpy2py(val) for val in vec ] + rclass = list(vec.do_slot('class')) if 'class' in attrs else vec.rclass + data = zip(names, values) + return { + 'DATA': dict(data), +- '_Names': cv.ri2py(names), ++ '_Names': cv.rpy2py(names), + # We don't give the rclass here because the old expect interface + # didn't do that either and we want to maintain compatibility. + }; +- cv.ri2py.register(ListSexpVector, _list_vector) ++ cv.rpy2py.register(ListSexpVector, _list_vector) + + return cv + |