From 807c53b3b632e727fd7085a183b08dff8c38a21f Mon Sep 17 00:00:00 2001 From: pcpa Date: Fri, 30 Dec 2016 10:04:34 -0500 Subject: [PATCH] Update to sagemath 7.4 --- .gitignore | 1 + sagemath-4ti2.patch | 6 +- sagemath-atlas.patch | 16 +- sagemath-cbc.patch | 6 +- sagemath-cremona.patch | 8 +- sagemath-extensions.patch | 28 +- sagemath-fes.patch | 6 +- sagemath-ftbfs.patch | 30 +- sagemath-gcc6.patch | 24 +- sagemath-givaro.patch | 103 +- sagemath-includes.patch | 47 +- sagemath-ipython3.patch | 1696 --------------------------------- sagemath-is_in_terminal.patch | 365 ------- sagemath-nofstring.patch | 24 +- sagemath-pari.patch | 65 +- sagemath-rpmbuild.patch | 40 +- sagemath-sagedoc.patch | 32 +- sagemath-scripts.patch | 154 ++- sagemath-sympy.patch | 8 +- sagemath.spec | 96 +- sources | 2 +- 21 files changed, 299 insertions(+), 2458 deletions(-) delete mode 100644 sagemath-ipython3.patch delete mode 100644 sagemath-is_in_terminal.patch diff --git a/.gitignore b/.gitignore index 200ffbe..9990a19 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /sage-6.5.tar.gz /sage-6.8.tar.gz /sage-7.3.tar.gz +/sage-7.4.tar.gz diff --git a/sagemath-4ti2.patch b/sagemath-4ti2.patch index 4196ee2..864176c 100644 --- a/sagemath-4ti2.patch +++ b/sagemath-4ti2.patch @@ -1,6 +1,6 @@ diff -up src/sage/sandpiles/sandpile.py.orig src/sage/sandpiles/sandpile.py ---- src/sage/sandpiles/sandpile.py.orig 2016-08-08 13:33:09.209528750 -0400 -+++ src/sage/sandpiles/sandpile.py 2016-08-08 13:33:36.251529786 -0400 +--- src/sage/sandpiles/sandpile.py.orig 2016-10-20 08:05:08.805531352 -0400 ++++ src/sage/sandpiles/sandpile.py 2016-10-20 08:05:17.107531669 -0400 @@ -346,9 +346,6 @@ from sage.arith.all import falling_facto from sage.rings.all import Integer, PolynomialRing, QQ, ZZ from sage.symbolic.all import I, pi @@ -11,7 +11,7 @@ diff -up src/sage/sandpiles/sandpile.py.orig src/sage/sandpiles/sandpile.py class Sandpile(DiGraph): """ Class for Dhar's abelian sandpile model. -@@ -5229,7 +5226,7 @@ class SandpileDivisor(dict): +@@ -5203,7 +5200,7 @@ class SandpileDivisor(dict): sign_file.close() # compute try: diff --git a/sagemath-atlas.patch b/sagemath-atlas.patch index 7a11783..8e83e40 100644 --- a/sagemath-atlas.patch +++ b/sagemath-atlas.patch @@ -1,7 +1,7 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-08-11 09:33:26.357108127 -0400 -+++ src/module_list.py 2016-08-11 09:34:15.543110010 -0400 -@@ -12,26 +12,20 @@ SAGE_INC = '/usr/include' +--- src/module_list.py.orig 2016-10-20 09:16:23.105695029 -0400 ++++ src/module_list.py 2016-10-20 09:17:17.868697126 -0400 +@@ -12,20 +12,14 @@ SAGE_INC = '/usr/include' import pkgconfig # CBLAS can be one of multiple implementations @@ -24,7 +24,9 @@ diff -up src/module_list.py.orig src/module_list.py +lapack_library_dirs = [] +lapack_include_dirs = [ SAGE_INC + '/lapack' ] - # GNU Scientific Library + # FFLAS-FFPACK + fflas_ffpack_pc = pkgconfig.parse('fflas-ffpack') +@@ -43,7 +37,7 @@ givaro_cflags = pkgconfig.cflags('givaro # Note we replace the built-in gslcblas with the above cblas gsl_pc = pkgconfig.parse('gsl') gsl_libs = list(gsl_pc['libraries'].difference(['gslcblas']).union(cblas_libs)) @@ -34,9 +36,9 @@ diff -up src/module_list.py.orig src/module_list.py # GD image library diff -up src/sage/misc/cython.py.orig src/sage/misc/cython.py ---- src/sage/misc/cython.py.orig 2016-08-11 09:33:26.362108127 -0400 -+++ src/sage/misc/cython.py 2016-08-11 09:33:29.353108241 -0400 -@@ -27,15 +27,11 @@ import pkgconfig +--- src/sage/misc/cython.py.orig 2016-10-20 09:17:25.057697402 -0400 ++++ src/sage/misc/cython.py 2016-10-20 09:17:43.339698102 -0400 +@@ -30,15 +30,11 @@ import pkgconfig # CBLAS can be one of multiple implementations diff --git a/sagemath-cbc.patch b/sagemath-cbc.patch index 4d91880..0e11a5e 100644 --- a/sagemath-cbc.patch +++ b/sagemath-cbc.patch @@ -1,7 +1,7 @@ diff -up src/sage/numerical/backends/coin_backend.pyx.orig src/sage/numerical/backends/coin_backend.pyx ---- src/sage/numerical/backends/coin_backend.pyx.orig 2016-08-08 13:41:10.063547164 -0400 -+++ src/sage/numerical/backends/coin_backend.pyx 2016-08-08 13:41:28.426547867 -0400 -@@ -755,8 +755,8 @@ cdef class CoinBackend(GenericBackend): +--- src/sage/numerical/backends/coin_backend.pyx.orig 2016-10-20 08:11:54.641546892 -0400 ++++ src/sage/numerical/backends/coin_backend.pyx 2016-10-20 08:12:03.505547232 -0400 +@@ -756,8 +756,8 @@ cdef class CoinBackend(GenericBackend): model.setLogLevel(old_logLevel) # multithreading diff --git a/sagemath-cremona.patch b/sagemath-cremona.patch index c0b0950..87591e0 100644 --- a/sagemath-cremona.patch +++ b/sagemath-cremona.patch @@ -1,6 +1,6 @@ diff -up src/sage/databases/cremona.py.orig src/sage/databases/cremona.py ---- src/sage/databases/cremona.py.orig 2016-08-08 13:36:38.575536768 -0400 -+++ src/sage/databases/cremona.py 2016-08-08 13:37:49.994539502 -0400 +--- src/sage/databases/cremona.py.orig 2016-10-20 08:11:03.521544935 -0400 ++++ src/sage/databases/cremona.py 2016-10-20 08:11:13.681545324 -0400 @@ -53,7 +53,6 @@ from sage.misc.prandom import randint import sage.schemes.elliptic_curves.constructor as elliptic @@ -9,7 +9,7 @@ diff -up src/sage/databases/cremona.py.orig src/sage/databases/cremona.py from sage.env import SAGE_SHARE from sage.misc.all import walltime -@@ -828,14 +827,6 @@ class MiniCremonaDatabase(SQLDatabase): +@@ -824,14 +823,6 @@ class MiniCremonaDatabase(SQLDatabase): if N < self.largest_conductor(): message = "There is no elliptic curve with label " + label \ + " in the database" @@ -24,7 +24,7 @@ diff -up src/sage/databases/cremona.py.orig src/sage/databases/cremona.py raise ValueError(message) ainvs = eval(c[0]) data = {'cremona_label': label, -@@ -1677,10 +1668,12 @@ def CremonaDatabase(name=None,mini=None, +@@ -1673,10 +1664,12 @@ def CremonaDatabase(name=None,mini=None, if name is None and not set_global: return _db if set_global and name is None: diff --git a/sagemath-extensions.patch b/sagemath-extensions.patch index 383b979..4f34627 100644 --- a/sagemath-extensions.patch +++ b/sagemath-extensions.patch @@ -1,7 +1,7 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-08-08 13:14:09.383485102 -0400 -+++ src/module_list.py 2016-08-08 13:17:44.834493353 -0400 -@@ -147,7 +147,6 @@ library_order["stdc++"] = 1000 +--- src/module_list.py.orig 2016-10-20 07:59:58.978519487 -0400 ++++ src/module_list.py 2016-10-20 08:00:12.330519999 -0400 +@@ -167,7 +167,6 @@ library_order["stdc++"] = 1000 ### ############################################################# @@ -9,7 +9,7 @@ diff -up src/module_list.py.orig src/module_list.py UNAME = os.uname() def uname_specific(name, value, alternative): -@@ -378,21 +377,21 @@ ext_modules = [ +@@ -398,21 +397,21 @@ ext_modules = [ libraries = ['flint'], extra_compile_args = ['-std=c99']), @@ -46,7 +46,7 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.graphs.planarity', sources = ['sage/graphs/planarity.pyx'], -@@ -411,10 +410,10 @@ ext_modules = [ +@@ -431,10 +430,10 @@ ext_modules = [ Extension('sage.graphs.graph_decompositions.cutwidth', sources = ['sage/graphs/graph_decompositions/cutwidth.pyx']), @@ -61,7 +61,7 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.graphs.spanning_tree', sources = ['sage/graphs/spanning_tree.pyx']), -@@ -553,18 +552,18 @@ ext_modules = [ +@@ -573,18 +572,18 @@ ext_modules = [ ## ################################ @@ -87,7 +87,7 @@ diff -up src/module_list.py.orig src/module_list.py ["sage/libs/fes.pyx"], language = "c", libraries = ['fes'], -@@ -597,17 +596,17 @@ ext_modules = [ +@@ -614,17 +613,17 @@ ext_modules = [ Extension('sage.libs.gmp.rational_reconstruction', sources = ['sage/libs/gmp/rational_reconstruction.pyx']), @@ -112,9 +112,9 @@ diff -up src/module_list.py.orig src/module_list.py +# libraries = ["homfly", "gc"], +# package="libhomfly"), - Extension('sage.libs.linbox.linbox', - sources = ['sage/libs/linbox/linbox.pyx'], -@@ -989,10 +988,10 @@ ext_modules = [ + # Extension('sage.libs.linbox.linbox', + # sources = ['sage/libs/linbox/linbox.pyx']), +@@ -997,10 +996,10 @@ ext_modules = [ Extension('sage.matrix.matrix_window', sources = ['sage/matrix/matrix_window.pyx']), @@ -129,7 +129,7 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.matrix.misc', sources = ['sage/matrix/misc.pyx'], -@@ -1025,12 +1024,6 @@ ext_modules = [ +@@ -1033,12 +1032,6 @@ ext_modules = [ Extension('*', ['sage/misc/*.pyx']), @@ -142,7 +142,7 @@ diff -up src/module_list.py.orig src/module_list.py ################################ ## ## sage.modular -@@ -1173,19 +1166,19 @@ ext_modules = [ +@@ -1190,19 +1183,19 @@ ext_modules = [ Extension("sage.numerical.backends.interactivelp_backend", ["sage/numerical/backends/interactivelp_backend.pyx"]), @@ -174,7 +174,7 @@ diff -up src/module_list.py.orig src/module_list.py ["sage/numerical/backends/coin_backend.pyx"], language = 'c++', libraries = ["Cbc", "CbcSolver", "Cgl", "Clp", "CoinUtils", -@@ -1677,7 +1670,7 @@ ext_modules = [ +@@ -1681,7 +1674,7 @@ ext_modules = [ ## ################################ @@ -183,7 +183,7 @@ diff -up src/module_list.py.orig src/module_list.py sources = ["sage/sat/solvers/cryptominisat/cryptominisat.pyx"], include_dirs = [os.path.join(SAGE_INC, "cmsat")] + zlib_include_dirs, language = "c++", -@@ -1685,7 +1678,7 @@ ext_modules = [ +@@ -1689,7 +1682,7 @@ ext_modules = [ library_dirs = zlib_library_dirs, package = 'cryptominisat'), diff --git a/sagemath-fes.patch b/sagemath-fes.patch index 667dbc5..2810445 100644 --- a/sagemath-fes.patch +++ b/sagemath-fes.patch @@ -1,7 +1,7 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-08-08 13:44:56.193555823 -0400 -+++ src/module_list.py 2016-08-08 13:45:10.146556357 -0400 -@@ -563,11 +563,11 @@ ext_modules = [ +--- src/module_list.py.orig 2016-10-20 08:12:42.137548711 -0400 ++++ src/module_list.py 2016-10-20 08:12:55.836549236 -0400 +@@ -583,11 +583,11 @@ ext_modules = [ sources = ["sage/libs/ecl.pyx"], libraries = ["ecl"]), diff --git a/sagemath-ftbfs.patch b/sagemath-ftbfs.patch index 4a1a4e7..2b61f1c 100644 --- a/sagemath-ftbfs.patch +++ b/sagemath-ftbfs.patch @@ -1,7 +1,7 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-12-20 18:33:57.413138357 -0200 -+++ src/module_list.py 2016-12-20 18:34:00.857036531 -0200 -@@ -24,7 +24,7 @@ lapack_include_dirs = [ SAGE_INC + '/lap +--- src/module_list.py.orig 2016-12-21 12:24:59.301116425 -0500 ++++ src/module_list.py 2016-12-21 12:25:33.927117751 -0500 +@@ -36,7 +36,7 @@ givaro_cflags = pkgconfig.cflags('givaro # GNU Scientific Library # Note we replace the built-in gslcblas with the above cblas gsl_pc = pkgconfig.parse('gsl') @@ -10,28 +10,10 @@ diff -up src/module_list.py.orig src/module_list.py gsl_library_dirs = list(cblas_pc['library_dirs']) gsl_include_dirs = list(gsl_pc['include_dirs']) -diff -up src/sage/structure/element_wrapper.pyx.orig src/sage/structure/element_wrapper.pyx ---- src/sage/structure/element_wrapper.pyx.orig 2016-12-20 18:33:57.416138269 -0200 -+++ src/sage/structure/element_wrapper.pyx 2016-12-20 18:34:20.210464296 -0200 -@@ -111,10 +111,10 @@ cdef class ElementWrapper(Element): - Element.__init__(self, parent=parent) - self.value = value - -- # When self is an extension type without a __dict__ attribute, -- # this prevents self.__dict__ to return whatever crap obtained by -- # lookup through the categories ... -- __dict__ = {} -+ # When self is an extension type without a __dict__ attribute, -+ # this prevents self.__dict__ to return whatever crap obtained by -+ # lookup through the categories ... -+ __dict__ = {} - - def __getstate__(self): - """ diff -up src/setup.py.orig src/setup.py ---- src/setup.py.orig 2016-12-20 18:33:57.414138328 -0200 -+++ src/setup.py 2016-12-20 18:34:00.858036501 -0200 -@@ -542,9 +542,9 @@ def run_cythonize(): +--- src/setup.py.orig 2016-12-21 12:26:52.909120775 -0500 ++++ src/setup.py 2016-12-21 12:27:00.759121076 -0500 +@@ -565,9 +565,9 @@ def run_cythonize(): # Sage uses these directives (mostly for historical reasons). Cython.Compiler.Options.embed_pos_in_docstring = True diff --git a/sagemath-gcc6.patch b/sagemath-gcc6.patch index 02e6ccc..1dbaade 100644 --- a/sagemath-gcc6.patch +++ b/sagemath-gcc6.patch @@ -1,7 +1,7 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-08-10 09:10:17.614742069 -0400 -+++ src/module_list.py 2016-08-10 09:11:22.887744568 -0400 -@@ -954,7 +954,7 @@ ext_modules = [ +--- src/module_list.py.orig 2016-10-20 08:30:33.400589734 -0400 ++++ src/module_list.py 2016-10-20 08:32:10.570593455 -0400 +@@ -964,7 +964,7 @@ ext_modules = [ library_dirs = m4ri_library_dirs, include_dirs = m4ri_include_dirs, depends = [SAGE_INC + "/m4rie/m4rie.h"], @@ -10,21 +10,3 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.matrix.matrix_modn_dense_float', sources = ['sage/matrix/matrix_modn_dense_float.pyx'], -@@ -962,7 +962,7 @@ ext_modules = [ - libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs, - library_dirs = cblas_library_dirs, - include_dirs = cblas_include_dirs, -- extra_compile_args = nocxx11_args + ['-DDISABLE_COMMENTATOR'] + givaro_extra_compile_args), -+ extra_compile_args = ['-std=c++11', '-D__GIVARO_modular_uint64_H', '-D__GIVARO_modular_int64_H'] + ['-DDISABLE_COMMENTATOR'] + givaro_extra_compile_args), - - Extension('sage.matrix.matrix_modn_dense_double', - sources = ['sage/matrix/matrix_modn_dense_double.pyx'], -@@ -970,7 +970,7 @@ ext_modules = [ - libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs, - library_dirs = cblas_library_dirs, - include_dirs = cblas_include_dirs, -- extra_compile_args = nocxx11_args + ["-D_XPG6", "-DDISABLE_COMMENTATOR"] -+ extra_compile_args = ['-std=c++11', '-D__GIVARO_modular_uint64_H', '-D__GIVARO_modular_int64_H'] + ["-D_XPG6", "-DDISABLE_COMMENTATOR"] - + m4ri_extra_compile_args + givaro_extra_compile_args), - - Extension('sage.matrix.matrix_modn_sparse', diff --git a/sagemath-givaro.patch b/sagemath-givaro.patch index e57de4d..9b50de5 100644 --- a/sagemath-givaro.patch +++ b/sagemath-givaro.patch @@ -1,73 +1,6 @@ -Some functions were moved from linbox to givaro, and some header files were -renamed in linbox 1.4 and givaro 4. - -diff -up src/sage/libs/linbox/echelonform.pxd.orig src/sage/libs/linbox/echelonform.pxd ---- src/sage/libs/linbox/echelonform.pxd.orig 2015-07-26 07:34:43.000000000 -0600 -+++ src/sage/libs/linbox/echelonform.pxd 2016-02-27 10:08:25.665593617 -0700 -@@ -1,23 +1,23 @@ - from sage.libs.linbox.modular cimport ModDoubleField, ModDoubleFieldElement, ModFloatField, ModFloatFieldElement - from libc.stdint cimport uint64_t - --cdef extern from "linbox/matrix/blas-matrix.h" namespace "LinBox": -- cdef cppclass BlasMatrixDouble "LinBox::BlasMatrix >": -+cdef extern from "linbox/matrix/densematrix/blas-matrix.h" namespace "LinBox": -+ cdef cppclass BlasMatrixDouble "LinBox::BlasMatrix >": - BlasMatrixDouble(ModDoubleField F, uint64_t nrows, uint64_t ncols) - void setEntry(size_t i, size_t j, ModDoubleFieldElement t) - ModDoubleFieldElement &getEntry(size_t i, size_t j) - -- cdef cppclass BlasMatrixFloat "LinBox::BlasMatrix >": -+ cdef cppclass BlasMatrixFloat "LinBox::BlasMatrix >": - BlasMatrixFloat(ModFloatField F, uint64_t nrows, uint64_t ncols) - void setEntry(size_t i, size_t j, ModFloatFieldElement t) - ModFloatFieldElement &getEntry(size_t i, size_t j) - - cdef extern from "linbox/algorithms/echelon-form.h": -- cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain >": -+ cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain >": - EchelonFormDomainDouble(ModDoubleField) - int rowReducedEchelon(BlasMatrixDouble, BlasMatrixDouble) - -- cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain >": -+ cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain >": - EchelonFormDomainFloat(ModFloatField) - int rowReducedEchelon(BlasMatrixFloat, BlasMatrixFloat) - -diff -up src/sage/libs/linbox/modular.pxd.orig src/sage/libs/linbox/modular.pxd ---- src/sage/libs/linbox/modular.pxd.orig 2015-07-26 07:34:43.000000000 -0600 -+++ src/sage/libs/linbox/modular.pxd 2016-02-26 20:00:09.329004419 -0700 -@@ -1,10 +1,10 @@ --cdef extern from "linbox/field/modular.h": -+cdef extern from "givaro/modular-double.h": - # double - -- cdef cppclass ModDoubleFieldElement "LinBox::Modular::Element": -+ cdef cppclass ModDoubleFieldElement "Givaro::Modular::Element": - pass - -- cdef cppclass ModDoubleField "LinBox::Modular": -+ cdef cppclass ModDoubleField "Givaro::Modular": - ModDoubleField(int modulus) - ModDoubleFieldElement init(ModDoubleFieldElement res, int v) - ModDoubleFieldElement init(ModDoubleFieldElement res, double v) -@@ -19,11 +19,12 @@ cdef extern from "linbox/field/modular.h - bint isZero(ModDoubleFieldElement x) - - -+cdef extern from "givaro/modular-float.h": - # float -- cdef cppclass ModFloatFieldElement "LinBox::Modular::Element": -+ cdef cppclass ModFloatFieldElement "Givaro::Modular::Element": - pass - -- cdef cppclass ModFloatField "LinBox::Modular": -+ cdef cppclass ModFloatField "Givaro::Modular": - ModFloatField(int modulus) - ModFloatFieldElement init(ModFloatFieldElement res, int v) - ModFloatFieldElement init(ModFloatFieldElement res, double v) diff -up src/sage/libs/singular/singular.pyx.orig src/sage/libs/singular/singular.pyx ---- src/sage/libs/singular/singular.pyx.orig 2015-07-26 07:34:43.000000000 -0600 -+++ src/sage/libs/singular/singular.pyx 2016-03-07 06:11:58.246631802 -0700 +--- src/sage/libs/singular/singular.pyx.orig 2016-10-20 08:19:08.767563517 -0400 ++++ src/sage/libs/singular/singular.pyx 2016-10-20 08:19:15.138563761 -0400 @@ -21,6 +21,8 @@ cdef extern from "limits.h": long INT_MAX long INT_MIN @@ -76,34 +9,4 @@ diff -up src/sage/libs/singular/singular.pyx.orig src/sage/libs/singular/singula + import os - from sage.libs.singular.decl cimport intvec -@@ -157,7 +159,7 @@ cdef FFgivE si2sa_GFqGivaro(number *n, r - order = cache.objectptr.cardinality() - 1 - - while z: -- c = cache.objectptr.initi(c, napGetCoeff(z)) -+ c = cache.objectptr.initi(c, napGetCoeff(z)) - e = napGetExpFrom(z,1, _ring) - if e == 0: - ret = cache.objectptr.add(ret, c, ret) -diff -up src/sage/rings/finite_rings/element_givaro.pxd.orig src/sage/rings/finite_rings/element_givaro.pxd ---- src/sage/rings/finite_rings/element_givaro.pxd.orig 2015-07-26 07:34:44.000000000 -0600 -+++ src/sage/rings/finite_rings/element_givaro.pxd 2016-02-26 17:45:57.983303693 -0700 -@@ -13,7 +13,7 @@ cdef extern from "givaro/givrandom.h": - - GivRandom GivRandomSeeded "Givaro::GivRandom"(unsigned long seed) - --cdef extern from "givaro/givgfq.h": -+cdef extern from "givaro/gfq.h": - ctypedef struct intvec "std::vector": - void (* push_back)(int elem) - -@@ -21,7 +21,7 @@ cdef extern from "givaro/givgfq.h": - - intvec intvec_factory "std::vector"(int len) - --cdef extern from "givaro/givgfq.h": -+cdef extern from "givaro/gfq.h": - - ctypedef struct GivaroGfq "Givaro::GFqDom": - #attributes + from libc.stdint cimport int64_t diff --git a/sagemath-includes.patch b/sagemath-includes.patch index 38d012e..6102b74 100644 --- a/sagemath-includes.patch +++ b/sagemath-includes.patch @@ -1,15 +1,15 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-08-10 11:12:07.237021979 -0400 -+++ src/module_list.py 2016-08-10 11:12:44.420023403 -0400 -@@ -89,6 +89,7 @@ except ValueError: +--- src/module_list.py.orig 2016-10-20 08:21:43.948569459 -0400 ++++ src/module_list.py 2016-10-20 08:28:34.226585170 -0400 +@@ -116,6 +116,7 @@ except ValueError: ######################################################### singular_libs = ['singular', 'flint', 'ntl', 'gmpxx', 'gmp', 'readline', 'm'] +singular_incs = [SAGE_INC + '/singular', SAGE_INC + '/factory'] ######################################################### - ### Givaro flags -@@ -172,16 +173,19 @@ ext_modules = [ + ### Library order +@@ -192,16 +193,19 @@ ext_modules = [ Extension('sage.algebras.letterplace.free_algebra_letterplace', sources = ['sage/algebras/letterplace/free_algebra_letterplace.pyx'], libraries = singular_libs, @@ -29,7 +29,7 @@ diff -up src/module_list.py.orig src/module_list.py language="c++"), Extension('sage.algebras.quatalg.quaternion_algebra_cython', -@@ -632,7 +636,8 @@ ext_modules = [ +@@ -644,7 +648,8 @@ ext_modules = [ [])), Extension('sage.libs.lrcalc.lrcalc', @@ -39,13 +39,12 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.libs.pari.closure', sources = ["sage/libs/pari/closure.pyx"]), -@@ -665,33 +670,39 @@ ext_modules = [ +@@ -677,31 +682,37 @@ ext_modules = [ Extension('sage.libs.singular.singular', sources = ['sage/libs/singular/singular.pyx'], - libraries = ['givaro'] + singular_libs, + libraries = singular_libs, + include_dirs = singular_incs, - language="c++", - extra_compile_args = givaro_extra_compile_args), + language="c++"), Extension('sage.libs.singular.polynomial', sources = ['sage/libs/singular/polynomial.pyx'], @@ -69,8 +68,7 @@ diff -up src/module_list.py.orig src/module_list.py sources = ['sage/libs/singular/function.pyx'], libraries = singular_libs, + include_dirs = singular_incs, - language="c++", - extra_compile_args = givaro_extra_compile_args), + language="c++"), Extension('sage.libs.singular.option', sources = ['sage/libs/singular/option.pyx'], @@ -79,7 +77,7 @@ diff -up src/module_list.py.orig src/module_list.py language="c++"), Extension('sage.libs.symmetrica.symmetrica', -@@ -700,17 +711,21 @@ ext_modules = [ +@@ -710,17 +721,21 @@ ext_modules = [ Extension('sage.libs.mpmath.utils', sources = ["sage/libs/mpmath/utils.pyx"], @@ -105,7 +103,7 @@ diff -up src/module_list.py.orig src/module_list.py ################################### ## -@@ -718,7 +733,8 @@ ext_modules = [ +@@ -728,7 +743,8 @@ ext_modules = [ ## ################################### @@ -115,7 +113,7 @@ diff -up src/module_list.py.orig src/module_list.py ################################### ## -@@ -891,7 +907,7 @@ ext_modules = [ +@@ -901,7 +917,7 @@ ext_modules = [ Extension("sage.matrix.matrix_complex_ball_dense", ["sage/matrix/matrix_complex_ball_dense.pyx"], libraries=['arb', 'mpfi', 'mpfr'], @@ -124,7 +122,7 @@ diff -up src/module_list.py.orig src/module_list.py language = "c++"), Extension('sage.matrix.matrix_complex_double_dense', -@@ -963,6 +979,7 @@ ext_modules = [ +@@ -971,6 +987,7 @@ ext_modules = [ Extension('sage.matrix.matrix_mpolynomial_dense', sources = ['sage/matrix/matrix_mpolynomial_dense.pyx'], libraries = singular_libs, @@ -132,7 +130,7 @@ diff -up src/module_list.py.orig src/module_list.py language="c++"), Extension('sage.matrix.matrix_rational_dense', -@@ -1284,6 +1301,7 @@ ext_modules = [ +@@ -1288,6 +1305,7 @@ ext_modules = [ Extension("sage.rings.complex_arb", ["sage/rings/complex_arb.pyx"], libraries=['mpfi', 'mpfr', 'gmp'], @@ -140,7 +138,7 @@ diff -up src/module_list.py.orig src/module_list.py language = 'c++'), Extension('sage.rings.complex_double', -@@ -1356,6 +1374,7 @@ ext_modules = [ +@@ -1360,6 +1378,7 @@ ext_modules = [ Extension("sage.rings.real_arb", ["sage/rings/real_arb.pyx"], libraries = ['mpfi', 'mpfr'], @@ -148,7 +146,7 @@ diff -up src/module_list.py.orig src/module_list.py language = 'c++'), Extension('sage.rings.real_lazy', -@@ -1562,17 +1581,20 @@ ext_modules = [ +@@ -1564,16 +1583,19 @@ ext_modules = [ Extension('sage.rings.polynomial.multi_polynomial_ideal_libsingular', sources = ['sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx'], libraries = singular_libs, @@ -159,8 +157,7 @@ diff -up src/module_list.py.orig src/module_list.py sources = ['sage/rings/polynomial/plural.pyx'], libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'], + include_dirs = singular_incs, - language="c++", - extra_compile_args = givaro_extra_compile_args), + language="c++"), Extension('sage.rings.polynomial.multi_polynomial_libsingular', sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'], @@ -170,11 +167,11 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.rings.polynomial.multi_polynomial_ring_generic', diff -up src/setup.py.orig src/setup.py ---- src/setup.py.orig 2016-08-10 11:12:07.241021980 -0400 -+++ src/setup.py 2016-08-10 11:12:09.577022069 -0400 -@@ -65,6 +65,7 @@ except KeyError: - +--- src/setup.py.orig 2016-10-20 08:28:56.912586039 -0400 ++++ src/setup.py 2016-10-20 08:29:26.634587177 -0400 +@@ -78,6 +78,7 @@ except KeyError: # search for dependencies and add to gcc -I + # this depends on SAGE_CYTHONIZED include_dirs = sage_include_directories(use_sources=True) +include_dirs.extend(['@@CYSIGNALS@@']) diff --git a/sagemath-ipython3.patch b/sagemath-ipython3.patch deleted file mode 100644 index 825bf25..0000000 --- a/sagemath-ipython3.patch +++ /dev/null @@ -1,1696 +0,0 @@ -diff -up src/sage/repl/attach.py.orig src/sage/repl/attach.py ---- src/sage/repl/attach.py.orig 2016-08-18 13:12:59.071122164 -0400 -+++ src/sage/repl/attach.py 2016-08-18 13:13:01.904122272 -0400 -@@ -13,7 +13,7 @@ Check that no file clutter is produced:: - sage: dir = tmp_dir() - sage: src = os.path.join(dir, 'foobar.sage') - sage: with open(src, 'w') as f: -- ....: f.write('print("")\n') -+ ....: f.write('print ""\n') - sage: attach(src) - - sage: os.listdir(dir) -@@ -67,13 +67,11 @@ character-by-character:: - # (at your option) any later version. - # http://www.gnu.org/licenses/ - #***************************************************************************** --from __future__ import print_function - - import os - import six - import time - from sage.repl.load import load, load_wrap --import sage.repl.inputhook - import sage.env - - # The attached files as a dict of {filename:mtime} -@@ -165,7 +163,7 @@ def load_attach_path(path=None, replace= - ['.'] - sage: t_dir = tmp_dir() - sage: fullpath = os.path.join(t_dir, 'test.py') -- sage: open(fullpath, 'w').write("print(37 * 3)") -+ sage: open(fullpath, 'w').write("print 37 * 3") - sage: attach('test.py') - Traceback (most recent call last): - ... -@@ -266,13 +264,6 @@ def attach(*files): - Attach a file or files to a running instance of Sage and also load - that file. - -- .. NOTE:: -- -- Attaching files uses the Python inputhook, which will conflict -- with other inputhook users. This generally includes GUI main loop -- integrations, for example tkinter. So you can only use tkinter or -- attach, but not both at the same time. -- - INPUT: - - - ``files`` -- a list of filenames (strings) to attach. -@@ -313,9 +304,9 @@ def attach(*files): - - sage: sage.repl.attach.reset() - sage: t1 = tmp_filename(ext='.py') -- sage: open(t1,'w').write("print('hello world')") -+ sage: open(t1,'w').write("print 'hello world'") - sage: t2 = tmp_filename(ext='.py') -- sage: open(t2,'w').write("print('hi there xxx')") -+ sage: open(t2,'w').write("print 'hi there xxx'") - sage: attach(t1, t2) - hello world - hi there xxx -@@ -371,7 +362,6 @@ def add_attached_file(filename): - sage: af.attached_files() - [] - """ -- sage.repl.inputhook.install() - fpath = os.path.abspath(filename) - attached[fpath] = os.path.getmtime(fpath) - -@@ -389,7 +379,7 @@ def attached_files(): - - sage: sage.repl.attach.reset() - sage: t = tmp_filename(ext='.py') -- sage: open(t,'w').write("print('hello world')") -+ sage: open(t,'w').write("print 'hello world'") - sage: attach(t) - hello world - sage: attached_files() -@@ -415,7 +405,7 @@ def detach(filename): - - sage: sage.repl.attach.reset() - sage: t = tmp_filename(ext='.py') -- sage: open(t,'w').write("print('hello world')") -+ sage: open(t,'w').write("print 'hello world'") - sage: attach(t) - hello world - sage: attached_files() == [t] -@@ -429,7 +419,7 @@ def detach(filename): - ['.'] - sage: t_dir = tmp_dir() - sage: fullpath = os.path.join(t_dir, 'test.py') -- sage: open(fullpath, 'w').write("print(37 * 3)") -+ sage: open(fullpath, 'w').write("print 37 * 3") - sage: load_attach_path(t_dir) - sage: attach('test.py') - 111 -@@ -441,7 +431,7 @@ def detach(filename): - sage: attach('test.py') - 111 - sage: fullpath = os.path.join(t_dir, 'test2.py') -- sage: open(fullpath, 'w').write("print(3)") -+ sage: open(fullpath, 'w').write("print 3") - sage: attach('test2.py') - 3 - sage: detach(attached_files()) -@@ -474,8 +464,6 @@ def detach(filename): - attached.pop(fpath) - else: - raise ValueError("file '{0}' is not attached, see attached_files()".format(filename)) -- if not attached: -- sage.repl.inputhook.uninstall() - - def reset(): - """ -@@ -485,7 +473,7 @@ def reset(): - - sage: sage.repl.attach.reset() - sage: t = tmp_filename(ext='.py') -- sage: open(t,'w').write("print('hello world')") -+ sage: open(t,'w').write("print 'hello world'") - sage: attach(t) - hello world - sage: attached_files() == [t] -diff -up src/sage/repl/display/fancy_repr.py.orig src/sage/repl/display/fancy_repr.py ---- src/sage/repl/display/fancy_repr.py.orig 2016-08-18 13:12:59.078122164 -0400 -+++ src/sage/repl/display/fancy_repr.py 2016-08-18 13:13:01.906122272 -0400 -@@ -119,7 +119,8 @@ class SomeIPythonRepr(ObjectReprABC): - .. automethod:: __call__ - """ - type_repr = _type_pprinters.copy() -- del type_repr[type] -+ del type_repr[types.TypeType] -+ del type_repr[types.ClassType] - del type_repr[types.BuiltinFunctionType] - del type_repr[types.FunctionType] - del type_repr[str] -@@ -250,7 +251,7 @@ class PlainPythonRepr(ObjectReprABC): - a custom representer. Note that it is undesirable to have a - trailing newline, and if we don't display it you can't fix - it:: -- -+ - sage: class Newline(object): - ....: def __repr__(self): - ....: return 'newline\n' -@@ -316,37 +317,12 @@ class TallListRepr(ObjectReprABC): - sage: format_list = TallListRepr().format_string - sage: format_list([1, 2, identity_matrix(2)]) - '[\n [1 0]\n1, 2, [0 1]\n]' -- -- Check that :trac:`18743` is fixed:: -- -- sage: class Foo(object): -- ....: def __repr__(self): -- ....: return '''BBB AA RRR -- ....: B B A A R R -- ....: BBB AAAA RRR -- ....: B B A A R R -- ....: BBB A A R R''' -- ....: def _repr_option(self, key): -- ....: return key == 'ascii_art' -- sage: F = Foo() -- sage: [F, F] -- [ -- BBB AA RRR BBB AA RRR -- B B A A R R B B A A R R -- BBB AAAA RRR BBB AAAA RRR -- B B A A R R B B A A R R -- BBB A A R R, BBB A A R R -- ] - """ - if not (isinstance(obj, (tuple, list)) and len(obj) > 0): - return False - ascii_art_repr = False - for o in obj: - try: -- ascii_art_repr = ascii_art_repr or o._repr_option('ascii_art') -- except (AttributeError, TypeError): -- pass -- try: - ascii_art_repr = ascii_art_repr or o.parent()._repr_option('element_ascii_art') - except (AttributeError, TypeError): - pass -diff -up src/sage/repl/display/formatter.py.orig src/sage/repl/display/formatter.py ---- src/sage/repl/display/formatter.py.orig 2016-08-18 13:12:59.083122164 -0400 -+++ src/sage/repl/display/formatter.py 2016-08-18 13:13:01.907122273 -0400 -@@ -97,7 +97,7 @@ class SageDisplayFormatter(DisplayFormat - self.dm.check_backend_class(BackendIPython) - - def format(self, obj, include=None, exclude=None): -- r""" -+ """ - Use the Sage rich output instead of IPython - - INPUT/OUTPUT: -@@ -124,44 +124,9 @@ class SageDisplayFormatter(DisplayFormat - 10*x + 9*x + 8*x + 7*x + 6*x + 5*x + 4*x + 3*x + 2*x + x - sage: shell.run_cell('%display default') - sage: shell.quit() -- -- TESTS:: -- -- sage: import os -- sage: from sage.env import SAGE_EXTCODE -- sage: example_png = os.path.join(SAGE_EXTCODE, 'doctest', 'rich_output', 'example.png') -- sage: from sage.repl.rich_output.backend_ipython import BackendIPython -- sage: backend = BackendIPython() -- sage: shell = get_test_shell() -- sage: backend.install(shell=shell) -- sage: shell.run_cell('get_ipython().display_formatter') -- -- sage: shell.run_cell('from IPython.display import Image') -- sage: shell.run_cell('ipython_image = Image("{0}")'.format(example_png)) -- sage: shell.run_cell('ipython_image') -- -- sage: shell.run_cell('get_ipython().display_formatter.format(ipython_image)') -- ({u'image/png': '\x89PNG...', -- u'text/plain': u''}, -- {}) - """ -- # First, use Sage rich output if there is any -- PLAIN_TEXT = u'text/plain' -- sage_format, sage_metadata = self.dm.displayhook(obj) -- assert PLAIN_TEXT in sage_format, 'plain text is always present' -- if sage_format.keys() != [PLAIN_TEXT]: -- return sage_format, sage_metadata -- # Second, try IPython widgets (obj._ipython_display_ and type registry) -- if self.ipython_display_formatter(obj): -- return {}, {} -- # Finally, try IPython rich representation (obj._repr_foo_ methods) -- if exclude is not None: -- exclude = list(exclude) + [PLAIN_TEXT] -- ipy_format, ipy_metadata = super(SageDisplayFormatter, self).format( -- obj, include=include, exclude=exclude) -- ipy_format.update(sage_format) -- ipy_metadata.update(sage_metadata) -- return ipy_format, ipy_metadata -+ return self.dm.displayhook(obj) -+ - - - class SagePlainTextFormatter(PlainTextFormatter): -@@ -190,7 +155,7 @@ class SagePlainTextFormatter(PlainTextFo - sage: from sage.repl.interpreter import get_test_shell - sage: shell = get_test_shell() - sage: shell.display_formatter.formatters['text/plain'] -- -+ - sage: shell.quit() - """ - super(SagePlainTextFormatter, self).__init__(*args, **kwds) -diff -up src/sage/repl/display/jsmol_iframe.py.orig src/sage/repl/display/jsmol_iframe.py ---- src/sage/repl/display/jsmol_iframe.py.orig 2016-08-18 13:12:59.088122165 -0400 -+++ src/sage/repl/display/jsmol_iframe.py 2016-08-18 13:13:01.908122273 -0400 -@@ -249,7 +249,7 @@ class JSMolHtml(SageObject): - String. - - EXAMPLES:: -- -+ - sage: from sage.repl.display.jsmol_iframe import JSMolHtml - sage: from sage.repl.rich_output.output_graphics3d import OutputSceneJmol - sage: jmol = JSMolHtml(OutputSceneJmol.example()) -@@ -276,7 +276,7 @@ class JSMolHtml(SageObject): - String - - EXAMPLES:: -- -+ - sage: from sage.repl.display.jsmol_iframe import JSMolHtml - sage: from sage.repl.rich_output.output_graphics3d import OutputSceneJmol - sage: jmol = JSMolHtml(OutputSceneJmol.example(), width=500, height=300) -diff -up src/sage/repl/display/pretty_print.py.orig src/sage/repl/display/pretty_print.py ---- src/sage/repl/display/pretty_print.py.orig 2016-08-18 13:12:59.093122165 -0400 -+++ src/sage/repl/display/pretty_print.py 2016-08-18 13:13:01.909122273 -0400 -@@ -74,12 +74,12 @@ class SagePrettyPrinter(PrettyPrinter): - See IPython documentation. - - EXAMPLES:: -- -+ - sage: 123 - 123 - - IPython pretty printers:: -- -+ - sage: set({1, 2, 3}) - {1, 2, 3} - sage: dict(zzz=123, aaa=99, xab=10) # sorted by keys -@@ -88,16 +88,20 @@ class SagePrettyPrinter(PrettyPrinter): - These are overridden in IPython in a way that we feel is somewhat - confusing, and we prefer to print them like plain Python which is - more informative. See :trac:`14466` :: -- -+ - sage: 'this is a string' - 'this is a string' - sage: type(123) - - sage: type - -+ sage: [type, type] -+ [, ] - sage: import types -- sage: type('name', (), {}) -- -+ sage: types.ClassType('name', (), {}) -+ -+ sage: types.TypeType -+ - sage: types.BuiltinFunctionType - - -diff -up src/sage/repl/display/util.py.orig src/sage/repl/display/util.py ---- src/sage/repl/display/util.py.orig 2016-08-18 13:12:59.099122165 -0400 -+++ src/sage/repl/display/util.py 2016-08-18 13:13:01.909122273 -0400 -@@ -14,7 +14,6 @@ methods elsewhere. - # the License, or (at your option) any later version. - # http://www.gnu.org/licenses/ - #***************************************************************************** --from __future__ import print_function - - - class TallListFormatter(object): -@@ -75,8 +74,8 @@ class TallListFormatter(object): - TESTS:: - - sage: from sage.repl.display.util import format_list -- sage: print(format_list.try_format( -- ....: [matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) for i in xrange(7)])) -+ sage: print format_list.try_format( -+ ....: [matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) for i in xrange(7)]) - [ - [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] - [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], -diff -up src/sage/repl/image.py.orig src/sage/repl/image.py ---- src/sage/repl/image.py.orig 2016-08-18 13:12:59.104122165 -0400 -+++ src/sage/repl/image.py 2016-08-18 13:13:01.910122273 -0400 -@@ -14,9 +14,8 @@ EXAMPLES:: - sage: from sage.repl.image import Image - sage: img = Image('RGB', (256, 256), 'white') - sage: pixels = img.pixels() -- sage: for x in range(img.width()): -- ....: for y in range(img.height()): -- ....: pixels[x, y] = (x, y, 100) -+ sage: for x, y in CartesianProduct(range(img.width()), range(img.height())): -+ ....: pixels[x, y] = (x, y, 100) - sage: img - 256x256px 24-bit RGB image - sage: type(img) -@@ -39,7 +38,7 @@ from sage.structure.sage_object import S - - class Image(SageObject): - -- def __init__(self, mode, size, color='white'): -+ def __init__(self, mode, size, color=0): - """ - Creates a new image with the given mode and size. - -@@ -76,12 +75,13 @@ class Image(SageObject): - - - ``size`` -- 2-tuple, containing (width, height) in pixels. - -- - ``color`` -- string or tuple of numeric. What colour to use -- for the image. Default is black. If given, this should be a -- a tuple with one value per band. When creating RGB images, -- you can also use colour strings as supported by the -- ImageColor module. If the colour is None, the image is not -- initialised. -+ - ``color`` -- string or numeric. What colour to use for the -+ image. Default is black. If given, this should be a single -+ integer or floating point value for single-band modes, and a -+ tuple for multi-band modes (one value per band). When -+ creating RGB images, you can also use colour strings as -+ supported by the ImageColor module. If the colour is None, -+ the image is not initialised. - - OUTPUT: - -@@ -90,7 +90,7 @@ class Image(SageObject): - EXAMPLES:: - - sage: from sage.repl.image import Image -- sage: Image('P', (16, 16), (13,)) -+ sage: Image('P', (16, 16), 13) - 16x16px 8-bit Color image - """ - self._pil = PIL.Image.new(mode, size, color) -@@ -232,7 +232,7 @@ class Image(SageObject): - EXAMPLES:: - - sage: from sage.repl.image import Image -- sage: img = Image('P', (12, 34), (13,)) -+ sage: img = Image('P', (12, 34), 13) - sage: filename = tmp_filename(ext='.png') - sage: img.save(filename) - sage: open(filename).read().startswith('\x89PNG') -diff -up src/sage/repl/interpreter.py.orig src/sage/repl/interpreter.py ---- src/sage/repl/interpreter.py.orig 2016-08-18 13:12:59.109122165 -0400 -+++ src/sage/repl/interpreter.py 2016-08-18 13:13:01.911122273 -0400 -@@ -76,18 +76,14 @@ Check that Cython source code appears in - sage: shell = get_test_shell() - sage: shell.run_cell('1/0') - --------------------------------------------------------------------------- -- ZeroDivisionError Traceback (most recent call last) -- in () -- ----> 1 Integer(1)/Integer(0) -+ .../sage/rings/integer_ring.pyx in sage.rings.integer_ring.IntegerRing_class._div (.../cythonized/sage/rings/integer_ring.c:...)() -+ ... cdef rational.Rational x = rational.Rational.__new__(rational.Rational) -+ ... if mpz_sgn(right.value) == 0: -+ ... raise ZeroDivisionError('Rational division by zero') -+ ... mpz_set(mpq_numref(x.value), left.value) -+ ... mpz_set(mpq_denref(x.value), right.value) - -- .../src/sage/rings/integer.pyx in sage.rings.integer.Integer.__div__ (.../cythonized/sage/rings/integer.c:...)() -- ... if type(left) is type(right): -- ... if mpz_sgn((right).value) == 0: -- -> ... raise ZeroDivisionError("rational division by zero") -- ... x = Rational.__new__(Rational) -- ... mpq_div_zz(x.value, (left).value, (right).value) -- -- ZeroDivisionError: rational division by zero -+ ZeroDivisionError: Rational division by zero - sage: shell.quit() - """ - -@@ -108,8 +104,8 @@ import re - import sys - from sage.repl.preparse import preparse - --from traitlets.config.loader import Config --from traitlets import Bool, Type -+from IPython import Config -+from IPython.utils.traitlets import Bool, Type - - from sage.env import SAGE_LOCAL - -@@ -184,6 +180,10 @@ class SageShellOverride(object): - """ - Run a system command. - -+ If the command is not a sage-specific binary, adjust the library -+ paths before calling system commands. See :trac:`975` for a -+ discussion of running system commands. -+ - This is equivalent to the sage-native-execute shell script. - - EXAMPLES:: -@@ -196,12 +196,22 @@ class SageShellOverride(object): - sage: shell.system_raw('true') - sage: shell.user_ns['_exit_code'] - 0 -+ sage: shell.system_raw('env | grep "^LD_LIBRARY_PATH=" | grep $SAGE_LOCAL') -+ sage: shell.user_ns['_exit_code'] -+ 1 - sage: shell.system_raw('R --version') - R version ... - sage: shell.user_ns['_exit_code'] - 0 - sage: shell.quit() - """ -+ path = os.path.join(SAGE_LOCAL, 'bin', -+ re.split(r'[\s|;&]', cmd)[0]) -+ if not os.access(path, os.X_OK): -+ libraries = 'LD_LIBRARY_PATH="$SAGE_ORIG_LD_LIBRARY_PATH";export LD_LIBRARY_PATH;' -+ if os.uname()[0]=='Darwin': -+ libraries += 'DYLD_LIBRARY_PATH="$SAGE_ORIG_DYLD_LIBRARY_PATH";export DYLD_LIBRARY_PATH;' -+ cmd = libraries+cmd - return super(SageShellOverride, self).system_raw(cmd) - - -@@ -362,7 +372,7 @@ class SageTestShell(SageShellOverride, T - --------------------------------------------------------------------------- - ZeroDivisionError Traceback (most recent call last) - ... -- ZeroDivisionError: rational division by zero -+ ZeroDivisionError: Rational division by zero - sage: rc is None - True - sage: shell.quit() -@@ -680,6 +690,10 @@ def get_test_shell(): - app.shell._restart() - except AttributeError: - pass -+ # overwrite the default (console + graphics) formatter with the plain text one -+ import sage.repl.display.formatter as formatter -+ app.shell.display_formatter.formatters['text/plain'] = ( -+ formatter.SagePlainTextFormatter(config=app.shell.config)) - # No quit noise - app.shell.verbose_quit = False - return app.shell -@@ -721,10 +735,10 @@ class SageTerminalApp(TerminalIPythonApp - name = u'Sage' - crash_handler_class = SageCrashHandler - -- test_shell = Bool(False, help='Whether the shell is a test shell') -- test_shell.tag(config=True) -- shell_class = Type(InteractiveShell, help='Type of the shell') -- shell_class.tag(config=True) -+ test_shell = Bool(False, config=True, -+ help='Whether the shell is a test shell') -+ shell_class = Type(InteractiveShell, config=True, -+ help='Type of the shell') - - def load_config_file(self, *args, **kwds): - r""" -@@ -741,7 +755,7 @@ class SageTerminalApp(TerminalIPythonApp - sage: from sage.misc.temporary_file import tmp_dir - sage: from sage.repl.interpreter import SageTerminalApp - sage: d = tmp_dir() -- sage: from IPython.paths import get_ipython_dir -+ sage: from IPython.utils.path import get_ipython_dir - sage: IPYTHONDIR = get_ipython_dir() - sage: os.environ['IPYTHONDIR'] = d - sage: SageTerminalApp().load_config_file() -diff -up src/sage/repl/ipython_extension.py.orig src/sage/repl/ipython_extension.py ---- src/sage/repl/ipython_extension.py.orig 2016-08-18 13:12:59.114122166 -0400 -+++ src/sage/repl/ipython_extension.py 2016-08-18 13:13:01.912122273 -0400 -@@ -15,8 +15,6 @@ A Sage extension which adds sage-specifi - - - ``%mode`` (like ``%maxima``, etc.) - -- - ``%%cython`` -- - * preparsing of input - - * loading Sage library -@@ -57,13 +55,12 @@ In contrast, input to the ``%time`` magi - 2 * 3^3 * 11 - sage: shell.quit() - """ --from __future__ import absolute_import - --from IPython.core.magic import Magics, magics_class, line_magic, cell_magic -+from IPython.core.magic import Magics, magics_class, line_magic - - from sage.repl.load import load_wrap -+ - from sage.env import SAGE_IMPORTALL, SAGE_STARTUP_FILE --from sage.misc.lazy_import import LazyImport - - @magics_class - class SageMagics(Magics): -@@ -324,38 +321,6 @@ class SageMagics(Magics): - except ValueError as err: - print(err) # do not show traceback - -- @cell_magic -- def cython(self, line, cell): -- """ -- Cython cell magic -- -- This is syntactic sugar on the -- :func:`~sage.misc.cython_c.cython` function. -- -- INPUT:: -- -- - ``line`` -- ignored. -- -- - ``cell`` -- string. The Cython source code to process. -- -- OUTPUT: -- -- None. The Cython code is compiled and loaded. -- -- EXAMPLES:: -- -- sage: from sage.repl.interpreter import get_test_shell -- sage: shell = get_test_shell() -- sage: shell.run_cell(''' -- ....: %%cython -- ....: def f(): -- ....: print('test') -- ....: ''') -- ....: shell.run_cell('f()') -- """ -- from sage.misc.cython_c import cython_compile -- return cython_compile(cell) -- - - class SageCustomizations(object): - -@@ -368,12 +333,19 @@ class SageCustomizations(object): - self.auto_magics = SageMagics(shell) - self.shell.register_magics(self.auto_magics) - -+ import sage.repl.display.formatter as formatter -+ self.shell.display_formatter.formatters['text/plain'] = ( -+ formatter.SagePlainTextFormatter(config=shell.config)) -+ - import sage.misc.edit_module as edit_module - self.shell.set_hook('editor', edit_module.edit_devel) - - self.init_inspector() - self.init_line_transforms() - -+ import inputhook -+ inputhook.install() -+ - import sage.all # until sage's import hell is fixed - - self.shell.verbose_quit = True -@@ -384,12 +356,31 @@ class SageCustomizations(object): - if SAGE_IMPORTALL == 'yes': - self.init_environment() - -+ - def register_interface_magics(self): - """ - Register magics for each of the Sage interfaces - """ -- from sage.repl.interface_magic import InterfaceMagic -- InterfaceMagic.register_all(self.shell) -+ from sage.misc.superseded import deprecation -+ import sage.interfaces.all -+ interfaces = [(name, obj) -+ for name, obj in sage.interfaces.all.__dict__.items() -+ if isinstance(obj, sage.interfaces.interface.Interface)] -+ -+ for real_name, obj in interfaces: -+ def tmp(line, name=real_name): -+ self.shell.run_cell('%s.interact()' % name) -+ tmp.__doc__ = "Interact with %s" % real_name -+ self.shell.register_magic_function(tmp, magic_name=real_name) -+ -+ obj_name = obj.name() -+ if real_name != obj_name: -+ def tmp_deprecated(line, name=real_name, badname=obj_name): -+ deprecation(6288, 'Use %%%s instead of %%%s.' % (name, -+ badname)) -+ self.shell.run_cell('%s.interact()' % name) -+ tmp_deprecated.__doc__ = "Interact with %s" % real_name -+ self.shell.register_magic_function(tmp_deprecated, magic_name=obj_name) - - def set_quit_hook(self): - """ -@@ -426,17 +417,19 @@ class SageCustomizations(object): - # that we could override; however, IPython looks them up in - # the global :class:`IPython.core.oinspect` module namespace. - # Thus, we have to monkey-patch. -+ import sage.misc.sagedoc as sagedoc -+ import sage.misc.sageinspect as sageinspect - import IPython.core.oinspect -- IPython.core.oinspect.getdoc = LazyImport("sage.misc.sageinspect", "sage_getdoc") -- IPython.core.oinspect.getsource = LazyImport("sage.misc.sagedoc", "my_getsource") -- IPython.core.oinspect.find_file = LazyImport("sage.misc.sageinspect", "sage_getfile") -- IPython.core.oinspect.getargspec = LazyImport("sage.misc.sageinspect", "sage_getargspec") -+ IPython.core.oinspect.getdoc = sageinspect.sage_getdoc -+ IPython.core.oinspect.getsource = sagedoc.my_getsource -+ IPython.core.oinspect.find_file = sageinspect.sage_getfile -+ IPython.core.oinspect.getargspec = sageinspect.sage_getargspec - - def init_line_transforms(self): - """ - Set up transforms (like the preparser). - """ -- from .interpreter import (SagePreparseTransformer, -+ from interpreter import (SagePreparseTransformer, - SagePromptTransformer) - - for s in (self.shell.input_splitter, self.shell.input_transformer_manager): -diff -up src/sage/repl/ipython_kernel/install.py.orig src/sage/repl/ipython_kernel/install.py ---- src/sage/repl/ipython_kernel/install.py.orig 2016-08-18 13:12:59.119122166 -0400 -+++ src/sage/repl/ipython_kernel/install.py 2016-08-18 13:13:01.912122273 -0400 -@@ -1,38 +1,41 @@ - """ --Installing the SageMath Jupyter Kernel and extensions -+Installing the Sage IPython Kernel - --Kernels have to register themselves with Jupyter so that they appear --in the Jupyter notebook's kernel drop-down. This is done by -+Kernels have to register themselves with IPython so that they appear -+in the IPython notebook's kernel drop-down. This is done by - :class:`SageKernelSpec`. - """ - - import os - import errno -+import copy -+ -+from IPython.kernel.kernelspec import ( -+ get_kernel_spec, install_kernel_spec, NoSuchKernel) -+from IPython.utils.path import get_ipython_dir - - from sage.env import ( - SAGE_ROOT, SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE, - SAGE_VERSION - ) --from jupyter_core.paths import ENV_JUPYTER_PATH --JUPYTER_PATH = ENV_JUPYTER_PATH[0] -+from sage.misc.temporary_file import tmp_dir - - - class SageKernelSpec(object): - - def __init__(self): - """ -- Utility to manage SageMath kernels and extensions -+ Utility to manage Sage kernels - - EXAMPLES:: - - sage: from sage.repl.ipython_kernel.install import SageKernelSpec - sage: spec = SageKernelSpec() - sage: spec._display_name # random output -- 'SageMath 6.9' -+ 'Sage 6.6.beta2' - """ -- self._display_name = 'SageMath {0}'.format(SAGE_VERSION) -- self.nbextensions_dir = os.path.join(JUPYTER_PATH, "nbextensions") -- self.kernel_dir = os.path.join(JUPYTER_PATH, "kernels", self.identifier()) -+ self._display_name = 'Sage {0}'.format(SAGE_VERSION) -+ self._ipython_dir = get_ipython_dir() - self._mkdirs() - - def _mkdirs(self): -@@ -44,33 +47,40 @@ class SageKernelSpec(object): - sage: from sage.repl.ipython_kernel.install import SageKernelSpec - sage: spec = SageKernelSpec() - sage: spec._mkdirs() -- sage: os.path.isdir(spec.nbextensions_dir) -+ sage: nbextensions = os.path.join(spec._ipython_dir, 'nbextensions') -+ sage: os.path.exists(nbextensions) - True - """ -- def mkdir_p(path): -+ def mkdir_p(*path_components): -+ path = os.path.join(*path_components) - try: - os.makedirs(path) -- except OSError: -- if not os.path.isdir(path): -+ except OSError as err: -+ if err.errno == errno.EEXIST and os.path.isdir(path): -+ pass -+ else: - raise -- mkdir_p(self.nbextensions_dir) -- mkdir_p(self.kernel_dir) -+ mkdir_p(self._ipython_dir, 'nbextensions') - - @classmethod -- def identifier(cls): -+ def identifier(self): - """ -- Internal identifier for the SageMath kernel -+ Internal identifier for the Sage kernel -+ -+ OUTPUT: - -- OUTPUT: the string ``"sagemath"``. -+ String. - - EXAMPLES:: - - sage: from sage.repl.ipython_kernel.install import SageKernelSpec -- sage: SageKernelSpec.identifier() -- 'sagemath' -+ sage: SageKernelSpec.identifier() # random output -+ 'sage_6_6_beta3' -+ sage: SageKernelSpec.identifier().startswith('sage_') -+ True - """ -- return 'sagemath' -- -+ return 'Sage {0}'.format(SAGE_VERSION).lower().replace(' ', '_').replace('.', '_') -+ - def symlink(self, src, dst): - """ - Symlink ``src`` to ``dst`` -@@ -95,48 +105,38 @@ class SageKernelSpec(object): - if err.errno == errno.EEXIST: - return - os.symlink(src, dst) -- -+ - def use_local_mathjax(self): - """ -- Symlink SageMath's Mathjax install to the Jupyter notebook. -+ Symlink Sage's Mathjax Install to the IPython notebook. - - EXAMPLES:: - - sage: from sage.repl.ipython_kernel.install import SageKernelSpec -+ sage: from IPython.utils.path import get_ipython_dir - sage: spec = SageKernelSpec() - sage: spec.use_local_mathjax() -- sage: mathjax = os.path.join(spec.nbextensions_dir, 'mathjax') -- sage: os.path.isdir(mathjax) -+ sage: ipython_dir = get_ipython_dir() -+ sage: mathjax = os.path.join(ipython_dir, 'nbextensions', 'mathjax') -+ sage: os.path.exists(mathjax) - True - """ - src = os.path.join(SAGE_LOCAL, 'share', 'mathjax') -- dst = os.path.join(self.nbextensions_dir, 'mathjax') -+ dst = os.path.join(self._ipython_dir, 'nbextensions', 'mathjax') - self.symlink(src, dst) - - def use_local_jsmol(self): -- """ -- Symlink jsmol to the Jupyter notebook. -- -- EXAMPLES:: -- -- sage: from sage.repl.ipython_kernel.install import SageKernelSpec -- sage: spec = SageKernelSpec() -- sage: spec.use_local_jsmol() -- sage: jsmol = os.path.join(spec.nbextensions_dir, 'jsmol') -- sage: os.path.isdir(jsmol) -- True -- """ - src = os.path.join(SAGE_LOCAL, 'share', 'jsmol') -- dst = os.path.join(self.nbextensions_dir, 'jsmol') -+ dst = os.path.join(self._ipython_dir, 'nbextensions', 'jsmol') - self.symlink(src, dst) - - def _kernel_cmd(self): - """ -- Helper to construct the SageMath kernel command. -- -+ Helper to construct the Sage kernel command. -+ - OUTPUT: - -- List of strings. The command to start a new SageMath kernel. -+ List of strings. The command to start a new Sage kernel. - - EXAMPLES:: - -@@ -144,7 +144,7 @@ class SageKernelSpec(object): - sage: spec = SageKernelSpec() - sage: spec._kernel_cmd() - ['/.../sage', -- '--python', -+ '-python', - '-m', - 'sage.repl.ipython_kernel', - '-f', -@@ -152,34 +152,40 @@ class SageKernelSpec(object): - """ - return [ - os.path.join(SAGE_ROOT, 'sage'), -- '--python', -+ '-python', - '-m', 'sage.repl.ipython_kernel', - '-f', '{connection_file}', - ] -- -+ - def kernel_spec(self): - """ - Return the kernel spec as Python dictionary - - OUTPUT: - -- A dictionary. See the Jupyter documentation for details. -+ A dictionary. See the IPython documentation for details. - - EXAMPLES:: - - sage: from sage.repl.ipython_kernel.install import SageKernelSpec - sage: spec = SageKernelSpec() - sage: spec.kernel_spec() -- {'argv': ..., 'display_name': 'SageMath ...'} -+ {'argv': ..., 'display_name': 'Sage ...'} - """ - return dict( - argv=self._kernel_cmd(), - display_name=self._display_name, - ) -- -+ - def _install_spec(self): - """ -- Install the SageMath Jupyter kernel -+ Install the Sage IPython kernel -+ -+ It is safe to call this method multiple times, only one Sage -+ kernel spec is ever installed for any given Sage -+ version. However, it resets the IPython kernel spec directory -+ so additional resources symlinked there are lost. See -+ :meth:`symlink_resources`. - - EXAMPLES:: - -@@ -187,17 +193,21 @@ class SageKernelSpec(object): - sage: spec = SageKernelSpec() - sage: spec._install_spec() # not tested - """ -- jsonfile = os.path.join(self.kernel_dir, "kernel.json") - import json -- with open(jsonfile, 'w') as f: -+ temp = tmp_dir() -+ kernel_spec = os.path.join(temp, 'kernel.json') -+ with open(kernel_spec, 'w') as f: - json.dump(self.kernel_spec(), f) -+ identifier = self.identifier() -+ install_kernel_spec(temp, identifier, user=True, replace=True) -+ self._spec = get_kernel_spec(identifier) - - def _symlink_resources(self): - """ - Symlink miscellaneous resources - -- This method symlinks additional resources (like the SageMath -- documentation) into the SageMath kernel directory. This is -+ This method symlinks additional resources (like the Sage -+ documentation) into the Sage kernel directory. This is - necessary to make the help links in the notebook work. - - EXAMPLES:: -@@ -207,23 +217,25 @@ class SageKernelSpec(object): - sage: spec._install_spec() # not tested - sage: spec._symlink_resources() # not tested - """ -+ assert self._spec, 'call _install_spec() first' -+ spec_dir = self._spec.resource_dir - path = os.path.join(SAGE_EXTCODE, 'notebook-ipython') - for filename in os.listdir(path): - self.symlink( - os.path.join(path, filename), -- os.path.join(self.kernel_dir, filename) -+ os.path.join(spec_dir, filename) - ) - self.symlink( -- os.path.join(SAGE_DOC, 'html', 'en'), -- os.path.join(self.kernel_dir, 'doc') -+ os.path.join(SAGE_DOC, 'output', 'html', 'en'), -+ os.path.join(spec_dir, 'doc') - ) -- -+ - @classmethod - def update(cls): - """ -- Configure the Jupyter notebook for the SageMath kernel -- -- This method does everything necessary to use the SageMath kernel, -+ Configure the IPython notebook for the Sage kernel -+ -+ This method does everything necessary to use the Sage kernel, - you should never need to call any of the other methods - directly. - -@@ -231,7 +243,7 @@ class SageKernelSpec(object): - - sage: from sage.repl.ipython_kernel.install import SageKernelSpec - sage: spec = SageKernelSpec() -- sage: spec.update() # not tested -+ sage: spec.update() - """ - instance = cls() - instance.use_local_mathjax() -@@ -239,18 +251,13 @@ class SageKernelSpec(object): - instance._install_spec() - instance._symlink_resources() - -- --def have_prerequisites(debug=True): -+ -+def have_prerequisites(): - """ -- Check that we have all prerequisites to run the Jupyter notebook. -+ Check that we have all prerequisites to run the IPython notebook. - -- In particular, the Jupyter notebook requires OpenSSL whether or -- not you are using https. See :trac:`17318`. -- -- INPUT: -- -- ``debug`` -- boolean (default: ``True``). Whether to print debug -- information in case that prerequisites are missing. -+ In particular, the IPython notebook requires OpenSSL whether or -+ not you are using https. See trac:`17318`. - - OUTPUT: - -@@ -259,14 +266,15 @@ def have_prerequisites(debug=True): - EXAMPLES:: - - sage: from sage.repl.ipython_kernel.install import have_prerequisites -- sage: have_prerequisites(debug=False) in [True, False] -+ sage: have_prerequisites() in [True, False] - True - """ - try: -- from notebook.notebookapp import NotebookApp -+ from IPython.html.notebookapp import NotebookApp - return True -- except ImportError: -- if debug: -- import traceback -- traceback.print_exc() -+ except ImportError as err: - return False -+ -+ -+ -+ -diff -up src/sage/repl/ipython_kernel/kernel.py.orig src/sage/repl/ipython_kernel/kernel.py ---- src/sage/repl/ipython_kernel/kernel.py.orig 2016-08-18 13:12:59.125122166 -0400 -+++ src/sage/repl/ipython_kernel/kernel.py 2016-08-18 13:13:01.913122273 -0400 -@@ -1,8 +1,8 @@ - """ - The Sage ZMQ Kernel - --Version of the Jupyter kernel when running Sage inside the Jupyter --notebook or remote Jupyter sessions. -+Version of the IPython kernel when running Sage inside the IPython -+notebook or remote IPython sessions. - """ - - #***************************************************************************** -@@ -15,9 +15,9 @@ notebook or remote Jupyter sessions. - #***************************************************************************** - - import sys --from ipykernel.ipkernel import IPythonKernel --from ipykernel.zmqshell import ZMQInteractiveShell --from traitlets import Type -+from IPython.kernel.zmq.ipkernel import IPythonKernel -+from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell -+from IPython.utils.traitlets import Type - - from sage.env import SAGE_VERSION, SAGE_EXTCODE, SAGE_DOC - from sage.repl.interpreter import SageNotebookInteractiveShell -@@ -27,7 +27,7 @@ class SageZMQInteractiveShell(SageNotebo - pass - - --class SageKernel(IPythonKernel): -+class SageKernel(IPythonKernel): - implementation = 'sage' - implementation_version = SAGE_VERSION - -@@ -35,11 +35,11 @@ class SageKernel(IPythonKernel): - - def __init__(self, **kwds): - """ -- The Sage Jupyter Kernel -+ The Sage IPython Kernel - - INPUT: - -- See the Jupyter documentation -+ See the IPython documentation - - EXAMPLES:: - -@@ -54,8 +54,8 @@ class SageKernel(IPythonKernel): - def banner(self): - r""" - The Sage Banner -- -- The value of this property is displayed in the Jupyter -+ -+ The value of this property is displayed in the IPython - notebook. - - OUTPUT: -@@ -67,7 +67,7 @@ class SageKernel(IPythonKernel): - sage: from sage.repl.ipython_kernel.kernel import SageKernel - sage: sk = SageKernel.__new__(SageKernel) - sage: sk.banner -- '...SageMath version...' -+ '\xe2\x94\x8c\xe2...SageMath Version...' - """ - from sage.misc.banner import banner_text - return banner_text() -@@ -75,16 +75,11 @@ class SageKernel(IPythonKernel): - @property - def help_links(self): - r""" -- Help in the Jupyter Notebook -- -+ Help in the IPython Notebook -+ - OUTPUT: - -- See the Jupyter documentation. -- -- .. NOTE:: -- -- Urls starting with "kernelspecs" are prepended by the -- browser with the appropriate path. -+ See the IPython documentation. - - EXAMPLES:: - -@@ -92,16 +87,16 @@ class SageKernel(IPythonKernel): - sage: sk = SageKernel.__new__(SageKernel) - sage: sk.help_links - [{'text': 'Sage Documentation', -- 'url': 'kernelspecs/sagemath/doc/index.html'}, -+ 'url': '/kernelspecs/sage_.../doc/index.html'}, - ...] - """ - from sage.repl.ipython_kernel.install import SageKernelSpec - identifier = SageKernelSpec.identifier() -- kernel_url = lambda x: 'kernelspecs/{0}/{1}'.format(identifier, x) -+ kernel_url = lambda x: '/kernelspecs/{0}/{1}'.format(identifier, x) - return [ - { - 'text': 'Sage Documentation', -- 'url': kernel_url('doc/index.html'), -+ 'url': kernel_url('doc/index.html') - }, - { - 'text': 'Sage Tutorial', -@@ -124,7 +119,7 @@ class SageKernel(IPythonKernel): - 'url': kernel_url('doc/reference/index.html'), - }, - { -- 'text': "Developer's Guide", -+ 'text': 'Developers Guide', - 'url': kernel_url('doc/developer/index.html'), - }, - { -@@ -164,7 +159,3 @@ class SageKernel(IPythonKernel): - 'url': "http://help.github.com/articles/github-flavored-markdown", - }, - ] -- -- def pre_handler_hook(self): -- from cysignals import init_cysignals -- self.saved_sigint_handler = init_cysignals() -diff -up src/sage/repl/ipython_kernel/__main__.py.orig src/sage/repl/ipython_kernel/__main__.py ---- src/sage/repl/ipython_kernel/__main__.py.orig 2016-08-18 13:12:59.131122166 -0400 -+++ src/sage/repl/ipython_kernel/__main__.py 2016-08-18 13:13:01.913122273 -0400 -@@ -1,3 +1,3 @@ --from ipykernel.kernelapp import IPKernelApp -+from IPython.kernel.zmq.kernelapp import IPKernelApp - from sage.repl.ipython_kernel.kernel import SageKernel - IPKernelApp.launch_instance(kernel_class=SageKernel) -diff -up src/sage/repl/preparse.py.orig src/sage/repl/preparse.py ---- src/sage/repl/preparse.py.orig 2016-08-18 13:12:59.137122166 -0400 -+++ src/sage/repl/preparse.py 2016-08-18 13:13:01.914122273 -0400 -@@ -216,7 +216,7 @@ Behind the scenes what happens is the fo - # (at your option) any later version. - # http://www.gnu.org/licenses/ - #***************************************************************************** --from __future__ import print_function -+ - - import os - import re -@@ -321,9 +321,9 @@ def strip_string_literals(code, state=No - '[%(L1)s, %(L2)s, %(L3)s, %(L4)s]' - sage: literals - {'L1': "'a'", 'L2': '"b"', 'L3': "'c'", 'L4': '"d\\""'} -- sage: print(s % literals) -+ sage: print s % literals - ['a', "b", 'c', "d\""] -- sage: print(strip_string_literals(r'-"\\\""-"\\"-')[0]) -+ sage: print strip_string_literals(r'-"\\\""-"\\"-')[0] - -%(L1)s-%(L2)s- - - Triple-quotes are handled as well:: -@@ -331,7 +331,7 @@ def strip_string_literals(code, state=No - sage: s, literals, state = strip_string_literals("[a, '''b''', c, '']") - sage: s - '[a, %(L1)s, c, %(L2)s]' -- sage: print(s % literals) -+ sage: print s % literals - [a, '''b''', c, ''] - - Comments are substitute too:: -@@ -449,9 +449,8 @@ def containing_block(code, ix, delimiter - sage: s = "factor(next_prime(L[5]+1))" - sage: s[22] - '+' -- sage: start, end = containing_block(s, 22) -- sage: start, end -- (17, 25) -+ sage: start, end = containing_block(s, 22); print start, end -+ 17 25 - sage: s[start:end] - '(L[5]+1)' - sage: s[20] -@@ -524,9 +523,9 @@ def parse_ellipsis(code, preparse_step=T - sage: [1.0..2.0] - [1.00000000000000, 2.00000000000000] - -- TESTS: -+ TESTS: - -- Check that nested ellipsis is processed correctly (:trac:`17378`):: -+ Check that nested ellipsis is processed correctly (:trac:`17378`):: - - sage: preparse('[1,..,2,..,len([1..3])]') - '(ellipsis_range(Integer(1),Ellipsis,Integer(2),Ellipsis,len((ellipsis_range(Integer(1),Ellipsis,Integer(3))))))' -@@ -586,9 +585,9 @@ def extract_numeric_literals(code): - - sage: from sage.repl.preparse import extract_numeric_literals - sage: code, nums = extract_numeric_literals("1.2 + 5") -- sage: print(code) -+ sage: print code - _sage_const_1p2 + _sage_const_5 -- sage: print(nums) -+ sage: print nums - {'_sage_const_1p2': "RealNumber('1.2')", '_sage_const_5': 'Integer(5)'} - - sage: extract_numeric_literals("[1, 1.1, 1e1, -1e-1, 1.]")[0] -@@ -662,9 +661,9 @@ def preparse_numeric_literals(code, extr - sage: preparse_numeric_literals("0x10.sqrt()") - 'Integer(0x10).sqrt()' - sage: preparse_numeric_literals('0o100') -- 'Integer(0o100)' -+ "Integer('100', 8)" - sage: preparse_numeric_literals('0b111001') -- 'Integer(0b111001)' -+ "Integer('111001', 2)" - sage: preparse_numeric_literals('0xe') - 'Integer(0xe)' - sage: preparse_numeric_literals('0xEAR') -@@ -721,18 +720,25 @@ def preparse_numeric_literals(code, extr - end += 1 - num += '.' - -- num_name = numeric_literal_prefix + num.replace('.', 'p').replace('-', 'n').replace('+', '') - -- if 'J' in postfix: -- num_make = "ComplexNumber(0, '%s')" % num -- num_name += 'j' -- elif len(num) < 2 or num[1] in 'oObBxX': -- num_make = "Integer(%s)" % num -- elif '.' in num or 'e' in num or 'E' in num: -- num_make = "RealNumber('%s')" % num -- elif num[0] == "0": -- num_make = "Integer('%s')" % num -+ if len(num)>2 and num[1] in 'oObBxX': -+ # Py3 oct and bin support -+ num_name = numeric_literal_prefix + num -+ if num[1] in 'bB': -+ num_make = "Integer('%s', 2)" % num[2:] -+ elif num[1] in 'oO': -+ num_make = "Integer('%s', 8)" % num[2:] -+ else: -+ num_make = "Integer(%s)" % num -+ elif '.' in num or 'e' in num or 'E' in num or 'J' in postfix: -+ num_name = numeric_literal_prefix + num.replace('.', 'p').replace('-', 'n').replace('+', '') -+ if 'J' in postfix: -+ num_make = "ComplexNumber(0, '%s')" % num -+ num_name += 'j' -+ else: -+ num_make = "RealNumber('%s')" % num - else: -+ num_name = numeric_literal_prefix + num - num_make = "Integer(%s)" % num - - literals[num_name] = num_make -@@ -1100,7 +1106,7 @@ def preparse(line, reset=True, do_time=F - 'a * BackslashOperator() * b \\' - - sage: preparse("time R. = ZZ[]", do_time=True) -- '__time__=misc.cputime(); __wall__=misc.walltime(); R = ZZ[\'x\']; print("Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__), misc.walltime(__wall__))); (x,) = R._first_ngens(1)' -+ '__time__=misc.cputime(); __wall__=misc.walltime(); R = ZZ[\'x\']; print "Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__), misc.walltime(__wall__)); (x,) = R._first_ngens(1)' - """ - global quote_state - if reset: -@@ -1171,8 +1177,8 @@ def preparse(line, reset=True, do_time=F - if do_time: - # Time keyword - L = re.sub(r';time;(\s*)(\S[^;]*)', -- r';\1__time__=misc.cputime(); __wall__=misc.walltime(); \2; print(' + -- '"Time: CPU %%.2f s, Wall: %%.2f s"%%(misc.cputime(__time__), misc.walltime(__wall__)))', -+ r';\1__time__=misc.cputime(); __wall__=misc.walltime(); \2; print ' + -+ '"Time: CPU %%.2f s, Wall: %%.2f s"%%(misc.cputime(__time__), misc.walltime(__wall__))', - L) - - # Remove extra ;'s -@@ -1216,7 +1222,7 @@ def preparse_file(contents, globals=None - sage: from sage.repl.preparse import preparse_file - sage: lots_of_numbers = "[%s]" % ", ".join(str(i) for i in range(3000)) - sage: _ = preparse_file(lots_of_numbers) -- sage: print(preparse_file("type(100r), type(100)")) -+ sage: print preparse_file("type(100r), type(100)") - _sage_const_100 = Integer(100) - type(100 ), type(_sage_const_100 ) - """ -@@ -1424,10 +1430,10 @@ def handle_encoding_declaration(contents - - Two hash marks are okay; this shows up in SageTeX-generated scripts:: - -- sage: contents = '## -*- coding: utf-8 -*-\nimport os, sys\nprint(x)' -+ sage: contents = '## -*- coding: utf-8 -*-\nimport os, sys\nprint x' - sage: handle_encoding_declaration(contents, sys.stdout) - ## -*- coding: utf-8 -*- -- 'import os, sys\nprint(x)' -+ 'import os, sys\nprint x' - - When the encoding declaration doesn't match the specification, we - spit out a default UTF-8 encoding. -@@ -1454,24 +1460,24 @@ def handle_encoding_declaration(contents - '#!/usr/local/bin/python\nimport os, sys' - - -- NOTES: -+ NOTES:: - -- - PEP 263: http://www.python.org/dev/peps/pep-0263/ -+ PEP 263: http://www.python.org/dev/peps/pep-0263/ - -- - PEP 263 says that Python will interpret a UTF-8 byte order mark -- as a declaration of UTF-8 encoding, but I don't think we do -- that; this function only sees a Python string so it can't -- account for a BOM. -+ PEP 263 says that Python will interpret a UTF-8 byte order mark -+ as a declaration of UTF-8 encoding, but I don't think we do -+ that; this function only sees a Python string so it can't -+ account for a BOM. - -- - We default to UTF-8 encoding even though PEP 263 says that -- Python files should default to ASCII. -+ We default to UTF-8 encoding even though PEP 263 says that -+ Python files should default to ASCII. - -- - Also see http://docs.python.org/ref/encodings.html. -+ Also see http://docs.python.org/ref/encodings.html. - -- AUTHORS: -+ AUTHORS:: - -- - Lars Fischer -- - Dan Drake (2010-12-08, rewrite for :trac:`10440`) -+ - Lars Fischer -+ - Dan Drake (2010-12-08, rewrite for ticket #10440) - """ - lines = contents.splitlines() - for num, line in enumerate(lines[:2]): -diff -up src/sage/repl/rich_output/backend_base.py.orig src/sage/repl/rich_output/backend_base.py ---- src/sage/repl/rich_output/backend_base.py.orig 2016-08-18 13:12:59.143122167 -0400 -+++ src/sage/repl/rich_output/backend_base.py 2016-08-18 13:14:03.167124618 -0400 -@@ -47,7 +47,6 @@ EXAMPLES:: - # the License, or (at your option) any later version. - # http://www.gnu.org/licenses/ - #***************************************************************************** --from __future__ import absolute_import - - from sage.structure.sage_object import SageObject - -@@ -187,27 +186,6 @@ class BackendBase(SageObject): - """ - raise NotImplementedError('derived classes must implement this method') - -- def is_in_terminal(self): -- """ -- Test whether the UI is meant to run in a terminal -- -- See -- :meth:`sage.repl.rich_output.display_manager.DisplayManager.is_in_terminal` -- for details. -- -- OUTPUT: -- -- Defaults to ``False``. -- -- EXAMPLES:: -- -- sage: from sage.repl.rich_output.backend_base import BackendBase -- sage: backend = BackendBase() -- sage: backend.is_in_terminal() -- False -- """ -- return False -- - def max_width(self): - """ - Return the number of characters that fit into one output line -@@ -510,8 +488,8 @@ class BackendBase(SageObject): - sage: _ # indirect doctest - 'foo' - """ -- from six.moves import builtins -- builtins._ = obj -+ import __builtin__ -+ __builtin__._ = obj - - def displayhook(self, plain_text, rich_output): - """ -diff -up src/sage/repl/rich_output/backend_doctest.py.orig src/sage/repl/rich_output/backend_doctest.py ---- src/sage/repl/rich_output/backend_doctest.py.orig 2016-08-18 13:12:59.148122167 -0400 -+++ src/sage/repl/rich_output/backend_doctest.py 2016-08-18 13:13:39.071123696 -0400 -@@ -86,7 +86,7 @@ class BackendDoctest(BackendBase): - backend. - - EXAMPLES:: -- -+ - sage: from sage.repl.rich_output.backend_doctest import BackendDoctest - sage: backend = BackendDoctest() - sage: backend.install() -@@ -104,7 +104,7 @@ class BackendDoctest(BackendBase): - should never call it by hand. - - EXAMPLES:: -- -+ - sage: from sage.repl.rich_output.backend_doctest import BackendDoctest - sage: backend = BackendDoctest() - sage: backend.install() -@@ -137,9 +137,6 @@ class BackendDoctest(BackendBase): - OutputImagePng, OutputImageGif, OutputImageJpg, - OutputImageSvg, OutputImagePdf, OutputImageDvi, - OutputSceneJmol, OutputSceneCanvas3d, OutputSceneWavefront, -- OutputVideoOgg, OutputVideoWebM, OutputVideoMp4, -- OutputVideoFlash, OutputVideoMatroska, OutputVideoAvi, -- OutputVideoWmv, OutputVideoQuicktime, - ]) - - def displayhook(self, plain_text, rich_output): -@@ -249,14 +246,6 @@ class BackendDoctest(BackendBase): - sage: backend.validate(dm.types.OutputSceneJmol.example()) - sage: backend.validate(dm.types.OutputSceneWavefront.example()) - sage: backend.validate(dm.types.OutputSceneCanvas3d.example()) -- sage: backend.validate(dm.types.OutputVideoOgg.example()) -- sage: backend.validate(dm.types.OutputVideoWebM.example()) -- sage: backend.validate(dm.types.OutputVideoMp4.example()) -- sage: backend.validate(dm.types.OutputVideoFlash.example()) -- sage: backend.validate(dm.types.OutputVideoMatroska.example()) -- sage: backend.validate(dm.types.OutputVideoAvi.example()) -- sage: backend.validate(dm.types.OutputVideoWmv.example()) -- sage: backend.validate(dm.types.OutputVideoQuicktime.example()) - """ - if isinstance(rich_output, OutputPlainText): - pass -@@ -286,34 +275,5 @@ class BackendDoctest(BackendBase): - assert rich_output.mtl.get().startswith('newmtl ') - elif isinstance(rich_output, OutputSceneCanvas3d): - assert rich_output.canvas3d.get().startswith('[{vertices:') -- elif isinstance(rich_output, OutputVideoOgg): -- assert rich_output.video.get().startswith('OggS') -- elif isinstance(rich_output, OutputVideoWebM): -- data = rich_output.video.get() -- assert data.startswith('\x1a\x45\xdf\xa3') -- assert '\x42\x82\x84webm' in data -- elif isinstance(rich_output, OutputVideoMp4): -- data = rich_output.video.get() -- assert data[4:8] == 'ftyp' -- assert data.startswith('\0\0\0') -- # See http://www.ftyps.com/ -- ftyps = [data[i:i+4] for i in range(8, ord(data[3]), 4)] -- del ftyps[1] # version number, not an ftyp -- expected = ['avc1', 'iso2', 'mp41', 'mp42'] -- assert any(i in ftyps for i in expected) -- elif isinstance(rich_output, OutputVideoFlash): -- assert rich_output.video.get().startswith('FLV\x01') -- elif isinstance(rich_output, OutputVideoMatroska): -- data = rich_output.video.get() -- assert data.startswith('\x1a\x45\xdf\xa3') -- assert '\x42\x82\x88matroska' in data -- elif isinstance(rich_output, OutputVideoAvi): -- data = rich_output.video.get() -- assert data[:4] == 'RIFF' and data[8:12] == 'AVI ' -- elif isinstance(rich_output, OutputVideoWmv): -- assert rich_output.video.get().startswith('\x30\x26\xb2\x75') -- elif isinstance(rich_output, OutputVideoQuicktime): -- data = rich_output.video.get() -- assert data[4:12] == 'ftypqt ' or data[4:8] == 'moov' - else: - raise TypeError('rich_output type not supported') -diff -up src/sage/repl/rich_output/backend_ipython.py.orig src/sage/repl/rich_output/backend_ipython.py ---- src/sage/repl/rich_output/backend_ipython.py.orig 2016-08-18 13:12:59.154122167 -0400 -+++ src/sage/repl/rich_output/backend_ipython.py 2016-08-18 13:14:14.599125056 -0400 -@@ -1,4 +1,4 @@ --# -*- coding: utf-8 -*- -+# -*- encoding: utf-8 -*- - """ - IPython Backend for the Sage Rich Output System - -@@ -108,7 +108,6 @@ class BackendIPython(BackendBase): - if not formatted: - return - publish_display_data(data=formatted, metadata=metadata) -- - - class BackendIPythonCommandline(BackendIPython): - """ -@@ -371,26 +370,38 @@ class BackendIPythonCommandline(BackendI - .format(jmol_cmd, launch_script)) - return 'Launched jmol viewer for {0}'.format(plain_text) - -- def is_in_terminal(self): -+ def launch_sage3d(self, output_wavefront, plain_text): - """ -- Test whether the UI is meant to run in a terminal -+ Launch the stand-alone java3d viewer - -- See -- :meth:`sage.repl.rich_output.display_manager.DisplayManager.is_in_terminal` -- for details. -+ INPUT: -+ -+ - ``output_wavefront`` -- -+ :class:`~sage.repl.rich_output.output_graphics3d.OutputSceneWavefront`. The -+ scene to launch Java3d with. -+ -+ - ``plain_text`` -- string. The plain text representation. - - OUTPUT: - -- ``True`` for the IPython commandline. -+ String. Human-readable message indicating that the viewer was launched. - - EXAMPLES:: - - sage: from sage.repl.rich_output.backend_ipython import BackendIPythonCommandline - sage: backend = BackendIPythonCommandline() -- sage: backend.is_in_terminal() -- True -+ sage: from sage.repl.rich_output.output_graphics3d import OutputSceneWavefront -+ sage: backend.launch_sage3d(OutputSceneWavefront.example(), 'Graphics3d object') -+ 'Launched Java 3D viewer for Graphics3d object' - """ -- return True -+ from sage.env import SAGE_LOCAL -+ sage3d = os.path.join(SAGE_LOCAL, 'bin', 'sage3d') -+ obj = output_wavefront.obj_filename() -+ from sage.doctest import DOCTEST_MODE -+ if not DOCTEST_MODE: -+ os.system('{0} {1} 2>/dev/null 1>/dev/null &' -+ .format(sage3d, obj)) -+ return 'Launched Java 3D viewer for {0}'.format(plain_text) - - class BackendIPythonNotebook(BackendIPython): - """ -@@ -450,8 +461,8 @@ class BackendIPythonNotebook(BackendIPyt - False - """ - return set([ -- OutputPlainText, OutputAsciiArt, OutputUnicodeArt, OutputLatex, - OutputHtml, -+ OutputPlainText, OutputAsciiArt, OutputUnicodeArt, OutputLatex, - OutputImagePng, OutputImageJpg, - OutputImageSvg, OutputImagePdf, - OutputSceneJmol, -diff -up src/sage/repl/rich_output/backend_sagenb.py.orig src/sage/repl/rich_output/backend_sagenb.py ---- src/sage/repl/rich_output/backend_sagenb.py.orig 2016-08-18 13:12:59.160122167 -0400 -+++ src/sage/repl/rich_output/backend_sagenb.py 2016-08-18 13:14:20.303125275 -0400 -@@ -38,21 +38,6 @@ filenames:: - sage: os.path.exists('sage0.png') - True - sage: os.remove('sage0.png') -- --Tables are typeset as html in SageNB:: -- -- sage: table([1, 2, 3]) --
-- -- -- -- -- -- -- -- --
--
- """ - - #***************************************************************************** -@@ -67,12 +52,10 @@ Tables are typeset as html in SageNB:: - import os - import stat - from sage.misc.cachefunc import cached_method --from sage.misc.html import html - from sage.misc.temporary_file import graphics_filename - from sage.doctest import DOCTEST_MODE - from sage.repl.rich_output.backend_base import BackendBase - from sage.repl.rich_output.output_catalog import * --from sage.repl.rich_output.output_video import OutputVideoBase - - - def world_readable(filename): -@@ -320,13 +303,12 @@ class BackendSageNB(BackendBase): - True - """ - return set([ -- OutputPlainText, OutputAsciiArt, OutputLatex, - OutputHtml, -+ OutputPlainText, OutputAsciiArt, OutputLatex, - OutputImagePng, OutputImageGif, OutputImageJpg, - OutputImagePdf, OutputImageSvg, - SageNbOutputSceneJmol, - OutputSceneCanvas3d, -- OutputVideoOgg, OutputVideoWebM, OutputVideoMp4, - ]) - - def display_immediately(self, plain_text, rich_output): -@@ -382,8 +364,6 @@ class BackendSageNB(BackendBase): - rich_output.embed() - elif isinstance(rich_output, OutputSceneCanvas3d): - self.embed_image(rich_output.canvas3d, '.canvas3d') -- elif isinstance(rich_output, OutputVideoBase): -- self.embed_video(rich_output) - else: - raise TypeError('rich_output type not supported, got {0}'.format(rich_output)) - -@@ -423,11 +403,4 @@ class BackendSageNB(BackendBase): - output_buffer.save_as(filename) - world_readable(filename) - -- def embed_video(self, video_output): -- filename = graphics_filename(ext=video_output.ext) -- video_output.video.save_as(filename) -- world_readable(filename) -- html(video_output.html_fragment( -- url='cell://' + filename, -- link_attrs='class="file_link"', -- )) -+ -diff -up src/sage/repl/rich_output/display_manager.py.orig src/sage/repl/rich_output/display_manager.py ---- src/sage/repl/rich_output/display_manager.py.orig 2016-08-18 13:12:59.166122168 -0400 -+++ src/sage/repl/rich_output/display_manager.py 2016-08-18 13:13:01.918122273 -0400 -@@ -343,26 +343,6 @@ class DisplayManager(SageObject): - """ - return self._preferences - -- def is_in_terminal(self): -- """ -- Test whether the UI is meant to run in a terminal -- -- When this method returns ``True``, you can assume that it is -- possible to use ``raw_input`` or launch external programs that -- take over the input. -- -- Otherwise, you should assume that the backend runs remotely or -- in a pty controlled by another program. Then you should not -- launch external programs with a (text or graphical) UI. -- -- This is used to enable/disable interpreter consoles. -- -- OUTPUT: -- -- Boolean. -- """ -- return self._backend.is_in_terminal() -- - def check_backend_class(self, backend_class): - """ - Check that the current backend is an instance of -diff -up src/sage/repl/rich_output/output_catalog.py.orig src/sage/repl/rich_output/output_catalog.py ---- src/sage/repl/rich_output/output_catalog.py.orig 2016-08-18 13:12:59.172122168 -0400 -+++ src/sage/repl/rich_output/output_catalog.py 2016-08-18 13:14:45.136126226 -0400 -@@ -40,14 +40,3 @@ from .output_graphics3d import ( - OutputSceneWavefront, - OutputSceneCanvas3d, - ) -- --from .output_video import ( -- OutputVideoOgg, -- OutputVideoWebM, -- OutputVideoMp4, -- OutputVideoFlash, -- OutputVideoMatroska, -- OutputVideoAvi, -- OutputVideoWmv, -- OutputVideoQuicktime, --) -diff -up src/sage/repl/rich_output/pretty_print.py.orig src/sage/repl/rich_output/pretty_print.py ---- src/sage/repl/rich_output/pretty_print.py.orig 2016-08-18 13:12:59.177122168 -0400 -+++ src/sage/repl/rich_output/pretty_print.py 2016-08-18 13:13:01.919122273 -0400 -@@ -210,20 +210,23 @@ def pretty_print(*args, **kwds): - sage: pretty_print(LatexExpr(r"\frac{x^2 + 1}{x - 2}")) - - -+ Iterators and generators are unwrapped:: -+ -+ sage: iterator = iter(range(3)); iterator -+ -+ sage: pretty_print(iterator) -+ -+ - TESTS:: - - sage: plt = plot(sin) - sage: pretty_print(plt) # graphics output -- sage: pretty_print(ZZ, 123, plt) # optional - latex -- -+ sage: pretty_print(ZZ, 123, plt) # latex output -+ - sage: pretty_print(plt, plt) # graphics output - """ -- # Support deprecation trac #18292 -- if len(args) == 1: -- import sage.misc.html -- if sage.misc.html.WarnIfNotPrinted.skip_pretty_print(args[0]): -- return -- -+ if len(args) == 1 and isinstance(args[0], (types.GeneratorType, collections.Iterator)): -+ args = tuple(args[0]) - dm = get_display_manager() - old_preferences_text = dm.preferences.text - try: diff --git a/sagemath-is_in_terminal.patch b/sagemath-is_in_terminal.patch deleted file mode 100644 index 0c80be1..0000000 --- a/sagemath-is_in_terminal.patch +++ /dev/null @@ -1,365 +0,0 @@ -diff -up src/sage/interfaces/all.py.orig src/sage/interfaces/all.py ---- src/sage/interfaces/all.py.orig 2016-08-15 07:14:53.947426922 -0400 -+++ src/sage/interfaces/all.py 2016-08-15 07:15:06.645427409 -0400 -@@ -48,8 +48,8 @@ interfaces = ['gap', 'gap3', 'giac', 'gp - 'singular', 'sage0', 'sage'] - - --from sage.repl.rich_output.display_manager import get_display_manager --if get_display_manager().is_in_terminal(): -+from sage.repl.rich_output.display_manager import is_in_terminal -+if is_in_terminal(): - from .axiom import axiom_console - from .fricas import fricas_console - from .gap import gap_console -diff -up src/sage/interfaces/axiom.py.orig src/sage/interfaces/axiom.py ---- src/sage/interfaces/axiom.py.orig 2016-08-15 07:15:43.388428816 -0400 -+++ src/sage/interfaces/axiom.py 2016-08-15 07:15:54.357429236 -0400 -@@ -1040,8 +1040,8 @@ def axiom_console(): - ----------------------------------------------------------------------------- - - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%axiom magics instead.') - os.system('axiom -nox') - -diff -up src/sage/interfaces/fricas.py.orig src/sage/interfaces/fricas.py ---- src/sage/interfaces/fricas.py.orig 2016-08-15 07:23:50.475447468 -0400 -+++ src/sage/interfaces/fricas.py 2016-08-15 07:23:57.869447751 -0400 -@@ -339,8 +339,8 @@ def fricas_console(): - Issue )quit to leave AXIOM and return to shell. - ----------------------------------------------------------------------------- - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%fricas magics instead.') - os.system('fricas -nox') - -diff -up src/sage/interfaces/gap3.py.orig src/sage/interfaces/gap3.py ---- src/sage/interfaces/gap3.py.orig 2016-08-15 07:15:18.659427869 -0400 -+++ src/sage/interfaces/gap3.py 2016-08-15 07:15:36.381428547 -0400 -@@ -886,8 +886,8 @@ def gap3_console(): - For help enter: ? - gap> - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%gap3 magics instead.') - os.system(gap3_cmd) - -diff -up src/sage/interfaces/gap.py.orig src/sage/interfaces/gap.py ---- src/sage/interfaces/gap.py.orig 2016-08-15 07:20:26.092439641 -0400 -+++ src/sage/interfaces/gap.py 2016-08-15 07:20:49.334440531 -0400 -@@ -1889,8 +1889,8 @@ def gap_console(): - sage: 'sorry' not in gap_startup - True - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%gap magics instead.') - cmd, _ = gap_command(use_workspace_cache=False) - cmd += ' ' + os.path.join(SAGE_EXTCODE,'gap','console.g') -diff -up src/sage/interfaces/giac.py.orig src/sage/interfaces/giac.py ---- src/sage/interfaces/giac.py.orig 2016-08-15 07:18:26.900435077 -0400 -+++ src/sage/interfaces/giac.py 2016-08-15 07:18:36.989435464 -0400 -@@ -1135,8 +1135,8 @@ def giac_console(): - Press CTRL and D simultaneously to finish session - Type ?commandname for help - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%giac magics instead.') - os.system('giac') - -diff -up src/sage/interfaces/gnuplot.py.orig src/sage/interfaces/gnuplot.py ---- src/sage/interfaces/gnuplot.py.orig 2016-08-15 07:22:26.123444238 -0400 -+++ src/sage/interfaces/gnuplot.py 2016-08-15 07:22:35.181444585 -0400 -@@ -190,8 +190,8 @@ gnuplot = Gnuplot() - - - def gnuplot_console(): -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%gnuplot magics instead.') - os.system('sage-native-execute gnuplot') - -diff -up src/sage/interfaces/gp.py.orig src/sage/interfaces/gp.py ---- src/sage/interfaces/gp.py.orig 2016-08-15 07:17:56.988433932 -0400 -+++ src/sage/interfaces/gp.py 2016-08-15 07:18:05.213434247 -0400 -@@ -1099,8 +1099,8 @@ def gp_console(): - compiled: Jul 21 2010, gcc-4.6.0 20100705 (experimental) (GCC) - (readline v6.0 enabled, extended help enabled) - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%gp magics instead.') - os.system('gp') - -diff -up src/sage/interfaces/kash.py.orig src/sage/interfaces/kash.py ---- src/sage/interfaces/kash.py.orig 2016-08-15 07:23:15.164446116 -0400 -+++ src/sage/interfaces/kash.py 2016-08-15 07:23:25.325446505 -0400 -@@ -699,8 +699,8 @@ def reduce_load_Kash(): - - - def kash_console(): -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%kash magics instead.') - os.system("kash3 ") - -diff -up src/sage/interfaces/lie.py.orig src/sage/interfaces/lie.py ---- src/sage/interfaces/lie.py.orig 2016-08-15 07:16:01.284429501 -0400 -+++ src/sage/interfaces/lie.py 2016-08-15 07:16:15.237430035 -0400 -@@ -935,8 +935,8 @@ def lie_console(): - ... - - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%lie magics instead.') - os.system('bash `which lie`') - -diff -up src/sage/interfaces/lisp.py.orig src/sage/interfaces/lisp.py ---- src/sage/interfaces/lisp.py.orig 2016-08-15 07:21:51.364442907 -0400 -+++ src/sage/interfaces/lisp.py 2016-08-15 07:22:00.925443273 -0400 -@@ -550,7 +550,7 @@ def lisp_console(): - Type :h for Help. Top level. - ... - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%lisp magics instead.') - os.system('ecl') -diff -up src/sage/interfaces/macaulay2.py.orig src/sage/interfaces/macaulay2.py ---- src/sage/interfaces/macaulay2.py.orig 2016-08-15 07:17:39.196433250 -0400 -+++ src/sage/interfaces/macaulay2.py 2016-08-15 07:17:48.989433625 -0400 -@@ -1222,8 +1222,8 @@ def macaulay2_console(): - ... - - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%macaulay2 magics instead.') - os.system('M2') - -diff -up src/sage/interfaces/magma.py.orig src/sage/interfaces/magma.py ---- src/sage/interfaces/magma.py.orig 2016-08-15 07:22:42.763444875 -0400 -+++ src/sage/interfaces/magma.py 2016-08-15 07:22:52.398445244 -0400 -@@ -2775,8 +2775,8 @@ def magma_console(): - > - Total time: 2.820 seconds, Total memory usage: 3.95MB - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%magma magics instead.') - console('sage-native-execute magma') - -diff -up src/sage/interfaces/maple.py.orig src/sage/interfaces/maple.py ---- src/sage/interfaces/maple.py.orig 2016-08-15 07:22:08.740443572 -0400 -+++ src/sage/interfaces/maple.py 2016-08-15 07:22:19.149443971 -0400 -@@ -1175,8 +1175,8 @@ def maple_console(): - | Type ? for help. - > - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%maple magics instead.') - os.system('maple') - -diff -up src/sage/interfaces/mathematica.py.orig src/sage/interfaces/mathematica.py ---- src/sage/interfaces/mathematica.py.orig 2016-08-15 07:17:01.475431806 -0400 -+++ src/sage/interfaces/mathematica.py 2016-08-15 07:17:13.797432278 -0400 -@@ -1007,8 +1007,8 @@ def reduce_load(X): - - - def mathematica_console(readline=True): -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%mathematica magics instead.') - if not readline: - os.system('math') -diff -up src/sage/interfaces/matlab.py.orig src/sage/interfaces/matlab.py ---- src/sage/interfaces/matlab.py.orig 2016-08-15 07:18:11.755434497 -0400 -+++ src/sage/interfaces/matlab.py 2016-08-15 07:18:20.261434823 -0400 -@@ -389,8 +389,8 @@ def matlab_console(): - matlab, like Sage, remembers its history from one session to - another. - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%matlab magics instead.') - os.system('matlab -nodisplay') - -diff -up src/sage/interfaces/maxima_abstract.py.orig src/sage/interfaces/maxima_abstract.py ---- src/sage/interfaces/maxima_abstract.py.orig 2016-08-15 07:24:41.539449423 -0400 -+++ src/sage/interfaces/maxima_abstract.py 2016-08-15 07:24:50.822449779 -0400 -@@ -2370,7 +2370,7 @@ def maxima_console(): - Maxima 5.34.1 http://maxima.sourceforge.net - ... - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%maxima magics instead.') - os.system('maxima') -diff -up src/sage/interfaces/mupad.py.orig src/sage/interfaces/mupad.py ---- src/sage/interfaces/mupad.py.orig 2016-08-15 07:24:03.851447980 -0400 -+++ src/sage/interfaces/mupad.py 2016-08-15 07:24:11.957448291 -0400 -@@ -686,8 +686,8 @@ def mupad_console(): - *----* Licensed to: ... - - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%mupad magics instead.') - os.system('mupkern') - -diff -up src/sage/interfaces/mwrank.py.orig src/sage/interfaces/mwrank.py ---- src/sage/interfaces/mwrank.py.orig 2016-08-15 07:22:59.484445515 -0400 -+++ src/sage/interfaces/mwrank.py 2016-08-15 07:23:08.637445866 -0400 -@@ -360,8 +360,8 @@ def mwrank_console(): - sage: mwrank_console() # not tested: expects console input - Program mwrank: ... - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%mwrank magics instead.') - os.system('mwrank') - -diff -up src/sage/interfaces/octave.py.orig src/sage/interfaces/octave.py ---- src/sage/interfaces/octave.py.orig 2016-08-15 07:24:17.604448507 -0400 -+++ src/sage/interfaces/octave.py 2016-08-15 07:24:26.741448857 -0400 -@@ -775,8 +775,8 @@ def octave_console(): - octave, like Sage, remembers its history from one session to - another. - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%octave magics instead.') - os.system('octave') - -diff -up src/sage/interfaces/qepcad.py.orig src/sage/interfaces/qepcad.py ---- src/sage/interfaces/qepcad.py.orig 2016-08-15 07:23:32.595446783 -0400 -+++ src/sage/interfaces/qepcad.py 2016-08-15 07:23:43.510447201 -0400 -@@ -1681,8 +1681,8 @@ def qepcad_console(memcells=None): - ... - Enter an informal description between '[' and ']': - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%qepcat magics instead.') - # This will only spawn local processes - os.system(_qepcad_cmd(memcells)) -diff -up src/sage/interfaces/r.py.orig src/sage/interfaces/r.py ---- src/sage/interfaces/r.py.orig 2016-08-15 07:16:22.108430298 -0400 -+++ src/sage/interfaces/r.py 2016-08-15 07:16:35.381430807 -0400 -@@ -2102,8 +2102,8 @@ def r_console(): - ISBN 3-900051-07-0 - ... - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%r magics instead.') - # This will only spawn local processes - os.system('R --vanilla') -diff -up src/sage/interfaces/sage0.py.orig src/sage/interfaces/sage0.py ---- src/sage/interfaces/sage0.py.orig 2016-08-15 07:18:49.708435951 -0400 -+++ src/sage/interfaces/sage0.py 2016-08-15 07:18:59.709436334 -0400 -@@ -531,8 +531,8 @@ def sage0_console(): - ---------------------------------------------------------------------- - ... - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%sage0 magics instead.') - os.system('sage') - -diff -up src/sage/interfaces/singular.py.orig src/sage/interfaces/singular.py ---- src/sage/interfaces/singular.py.orig 2016-08-15 07:16:42.556431082 -0400 -+++ src/sage/interfaces/singular.py 2016-08-15 07:16:52.990431481 -0400 -@@ -2329,8 +2329,8 @@ def singular_console(): - by: G.-M. Greuel, G. Pfister, H. Schoenemann \ Nov 2007 - FB Mathematik der Universitaet, D-67653 Kaiserslautern \ - """ -- from sage.repl.rich_output.display_manager import get_display_manager -- if not get_display_manager().is_in_terminal(): -+ from sage.repl.rich_output.display_manager import is_in_terminal -+ if not is_in_terminal(): - raise RuntimeError('Can use the console only in the terminal. Try %%singular magics instead.') - os.system('Singular') - -diff -up src/sage/repl/interface_magic.py.orig src/sage/repl/interface_magic.py ---- src/sage/repl/interface_magic.py.orig 2016-08-15 07:19:09.596436712 -0400 -+++ src/sage/repl/interface_magic.py 2016-08-15 07:21:27.789442004 -0400 -@@ -35,7 +35,7 @@ language to separate multiple commands. - #***************************************************************************** - - --from sage.repl.rich_output.display_manager import get_display_manager -+from sage.repl.rich_output.display_manager import is_in_terminal - - - LINE_DOCSTRING = """ -@@ -218,7 +218,7 @@ class InterfaceMagic(object): - The line magic %gap sends a single line to the gap interface. - ... - """ -- terminal = get_display_manager().is_in_terminal() -+ terminal = is_in_terminal() - def line_magic(line): - if line: - return self._interface(line) -diff -up src/sage/repl/rich_output/display_manager.py.orig src/sage/repl/rich_output/display_manager.py ---- src/sage/repl/rich_output/display_manager.py.orig 2016-08-15 07:13:57.603424765 -0400 -+++ src/sage/repl/rich_output/display_manager.py 2016-08-15 07:14:21.309425673 -0400 -@@ -775,3 +775,6 @@ class DisplayManager(SageObject): - - - get_display_manager = DisplayManager.get_instance -+def is_in_terminal(): -+ from sage.repl.rich_output.backend_ipython import BackendIPythonCommandline -+ return isinstance(get_display_manager(), BackendIPythonCommandline) diff --git a/sagemath-nofstring.patch b/sagemath-nofstring.patch index 5b239d0..a9667f3 100644 --- a/sagemath-nofstring.patch +++ b/sagemath-nofstring.patch @@ -1,7 +1,7 @@ diff -up src/sage/arith/multi_modular.pyx.orig src/sage/arith/multi_modular.pyx ---- src/sage/arith/multi_modular.pyx.orig 2016-08-09 07:06:34.166635024 -0400 -+++ src/sage/arith/multi_modular.pyx 2016-08-09 07:06:58.190635944 -0400 -@@ -171,9 +171,9 @@ cdef class MultiModularBasis_base(object +--- src/sage/arith/multi_modular.pyx.orig 2016-10-20 08:20:20.321566257 -0400 ++++ src/sage/arith/multi_modular.pyx 2016-10-20 08:20:45.522567222 -0400 +@@ -172,9 +172,9 @@ cdef class MultiModularBasis_base(object ArithmeticError: The inverse of 6 modulo 10 is not defined. """ if l_bound < 2: @@ -13,7 +13,7 @@ diff -up src/sage/arith/multi_modular.pyx.orig src/sage/arith/multi_modular.pyx self._l_bound = l_bound self._u_bound = u_bound -@@ -232,7 +232,7 @@ cdef class MultiModularBasis_base(object +@@ -233,7 +233,7 @@ cdef class MultiModularBasis_base(object if check: for p in plist: if p > MAX_MODULUS: @@ -23,8 +23,8 @@ diff -up src/sage/arith/multi_modular.pyx.orig src/sage/arith/multi_modular.pyx cdef Py_ssize_t i diff -up src/sage/rings/finite_rings/integer_mod.pyx.orig src/sage/rings/finite_rings/integer_mod.pyx ---- src/sage/rings/finite_rings/integer_mod.pyx.orig 2016-08-09 07:06:34.179635024 -0400 -+++ src/sage/rings/finite_rings/integer_mod.pyx 2016-08-09 07:07:05.471636223 -0400 +--- src/sage/rings/finite_rings/integer_mod.pyx.orig 2016-10-20 08:20:40.398567026 -0400 ++++ src/sage/rings/finite_rings/integer_mod.pyx 2016-10-20 08:20:45.526567222 -0400 @@ -392,7 +392,7 @@ cdef class IntegerMod_abstract(FiniteRin from integer_mod_ring import IntegerModRing R = IntegerModRing(modulus) @@ -35,9 +35,9 @@ diff -up src/sage/rings/finite_rings/integer_mod.pyx.orig src/sage/rings/finite_ def is_nilpotent(self): diff -up src/sage/structure/parent.pyx.orig src/sage/structure/parent.pyx ---- src/sage/structure/parent.pyx.orig 2016-08-09 07:06:34.157635023 -0400 -+++ src/sage/structure/parent.pyx 2016-08-09 07:06:50.239635639 -0400 -@@ -753,7 +753,7 @@ cdef class Parent(category_object.Catego +--- src/sage/structure/parent.pyx.orig 2016-10-20 08:20:20.325566257 -0400 ++++ src/sage/structure/parent.pyx 2016-10-20 08:20:45.529567222 -0400 +@@ -733,7 +733,7 @@ cdef class Parent(category_object.Catego cdef int init_coerce(self, bint warn=True) except -1: if self._coerce_from_hash is None: if warn: @@ -47,9 +47,9 @@ diff -up src/sage/structure/parent.pyx.orig src/sage/structure/parent.pyx self._initial_action_list = [] self._initial_convert_list = [] diff -up src/sage/symbolic/ring.pyx.orig src/sage/symbolic/ring.pyx ---- src/sage/symbolic/ring.pyx.orig 2016-08-09 07:06:34.173635024 -0400 -+++ src/sage/symbolic/ring.pyx 2016-08-09 07:07:01.438636068 -0400 -@@ -350,7 +350,7 @@ cdef class SymbolicRing(CommutativeRing) +--- src/sage/symbolic/ring.pyx.orig 2016-10-20 08:20:20.327566257 -0400 ++++ src/sage/symbolic/ring.pyx 2016-10-20 08:20:45.531567222 -0400 +@@ -355,7 +355,7 @@ cdef class SymbolicRing(CommutativeRing) from sage.misc.all import prod return prod([SR(p)**e for p,e in x], SR(x.unit())) else: diff --git a/sagemath-pari.patch b/sagemath-pari.patch index d5b95d5..df8610d 100644 --- a/sagemath-pari.patch +++ b/sagemath-pari.patch @@ -1,25 +1,17 @@ diff -up src/sage/libs/pari/handle_error.pxd.orig src/sage/libs/pari/handle_error.pxd ---- src/sage/libs/pari/handle_error.pxd.orig 2015-10-11 17:43:43.037782565 -0300 -+++ src/sage/libs/pari/handle_error.pxd 2015-10-11 17:46:28.004788882 -0300 +--- src/sage/libs/pari/handle_error.pxd.orig 2016-10-20 08:06:47.720535139 -0400 ++++ src/sage/libs/pari/handle_error.pxd 2016-10-20 08:07:01.459535665 -0400 @@ -1,5 +1,5 @@ - include 'sage/libs/pari/decl.pxi' + from .types cimport GEN cdef void _pari_init_error_handling() -cdef int _pari_err_handle(GEN E) except 0 +cdef int _pari_handle_exception(long errnum_unused) except 0 cdef void _pari_err_recover(long errnum) diff -up src/sage/libs/pari/handle_error.pyx.orig src/sage/libs/pari/handle_error.pyx ---- src/sage/libs/pari/handle_error.pyx.orig 2015-10-11 17:43:43.023782564 -0300 -+++ src/sage/libs/pari/handle_error.pyx 2015-10-11 17:45:11.844785966 -0300 -@@ -131,13 +131,13 @@ cdef void _pari_init_error_handling(): - sage: pari('warning("test")') - *** user warning: test - """ -- global cb_pari_err_handle -+ global cb_pari_handle_exception - global cb_pari_err_recover -- cb_pari_err_handle = _pari_err_handle -+ cb_pari_handle_exception = _pari_handle_exception +--- src/sage/libs/pari/handle_error.pyx.orig 2016-10-20 08:07:12.336536082 -0400 ++++ src/sage/libs/pari/handle_error.pyx 2016-10-20 08:08:23.089538791 -0400 +@@ -139,7 +139,7 @@ cdef void _pari_init_error_handling(): cb_pari_err_recover = _pari_err_recover @@ -28,34 +20,35 @@ diff -up src/sage/libs/pari/handle_error.pyx.orig src/sage/libs/pari/handle_erro """ Convert a PARI error into a Sage exception, unless the error was a stack overflow, in which case we enlarge the stack. -@@ -156,6 +156,7 @@ cdef int _pari_err_handle(GEN E) except +@@ -158,11 +158,11 @@ cdef int _pari_err_handle(GEN E) except PariError: impossible inverse in gdiv: 0 """ + cdef GEN E = pari_err_last() cdef long errnum = E[1] - if errnum == e_STACK: - # PARI is out of memory. We double the size of the PARI stack -@@ -165,15 +166,10 @@ cdef int _pari_err_handle(GEN E) except sig_block() cdef char* errstr - cdef char* s try: - errstr = pari_err2str(E) - pari_error_string = errstr.decode('ascii') - + if errnum == e_STACK: + # Custom error message for PARI stack overflow +@@ -173,11 +173,6 @@ cdef int _pari_err_handle(GEN E) except + errstr = pari_err2str(E) + pari_error_string = errstr.decode('ascii') + pari_free(errstr) +- - s = closure_func_err() - if s is not NULL: - pari_error_string = s.decode('ascii') + ": " + pari_error_string - raise PariError(errnum, pari_error_string, pari_instance.new_gen_noclear(E)) finally: - pari_free(errstr) + sig_unblock() diff -up src/sage/libs/pari/pari_instance.pxd.orig src/sage/libs/pari/pari_instance.pxd ---- src/sage/libs/pari/pari_instance.pxd.orig 2015-10-11 17:43:43.028782564 -0300 -+++ src/sage/libs/pari/pari_instance.pxd 2015-10-11 17:45:37.884786963 -0300 -@@ -7,6 +7,10 @@ cimport cython +--- src/sage/libs/pari/pari_instance.pxd.orig 2016-10-20 08:08:33.152539177 -0400 ++++ src/sage/libs/pari/pari_instance.pxd 2016-10-20 08:08:51.209539868 -0400 +@@ -5,6 +5,10 @@ cimport cython from sage.libs.pari.gen cimport gen @@ -64,21 +57,21 @@ diff -up src/sage/libs/pari/pari_instance.pxd.orig src/sage/libs/pari/pari_insta + cdef void mp_set_memory_functions(void*, void*, void*) + cpdef long prec_bits_to_words(unsigned long prec_in_bits) - - cdef class PariInstance_auto(ParentWithBase): + cpdef long prec_words_to_bits(long prec_in_words) + cpdef long default_bitprec() diff -up src/sage/libs/pari/pari_instance.pyx.orig src/sage/libs/pari/pari_instance.pyx ---- src/sage/libs/pari/pari_instance.pyx.orig 2015-10-11 17:43:43.032782565 -0300 -+++ src/sage/libs/pari/pari_instance.pyx 2015-10-11 17:46:14.596788369 -0300 -@@ -429,7 +429,12 @@ cdef class PariInstance(PariInstance_aut - # The size here doesn't really matter, because we will allocate - # our own stack anyway. We ask PARI not to set up signal and - # error handlers. +--- src/sage/libs/pari/pari_instance.pyx.orig 2016-10-20 08:09:05.632540421 -0400 ++++ src/sage/libs/pari/pari_instance.pyx 2016-10-20 08:10:25.322543472 -0400 +@@ -475,7 +475,12 @@ cdef class PariInstance(PariInstance_aut + from sage.misc.memory_info import MemoryInfo + mem = MemoryInfo() + + cdef void *_gmp_malloc + cdef void *_gmp_realloc + cdef void *_gmp_free + mp_get_memory_functions(&_gmp_malloc, &_gmp_realloc, &_gmp_free) - pari_init_opts(10000, maxprime, INIT_DFTm) + pari_init_opts(size, maxprime, INIT_DFTm) + mp_set_memory_functions(_gmp_malloc, _gmp_realloc, _gmp_free) + + sizemax = mem.virtual_memory_limit() // 4 - # Disable PARI's stack overflow checking which is incompatible - # with multi-threading. diff --git a/sagemath-rpmbuild.patch b/sagemath-rpmbuild.patch index 2cfe1ef..9274762 100644 --- a/sagemath-rpmbuild.patch +++ b/sagemath-rpmbuild.patch @@ -1,6 +1,6 @@ diff -up src/module_list.py.orig src/module_list.py ---- src/module_list.py.orig 2016-08-08 13:18:16.519494566 -0400 -+++ src/module_list.py 2016-08-08 13:18:29.570495066 -0400 +--- src/module_list.py.orig 2016-10-20 08:01:32.743523078 -0400 ++++ src/module_list.py 2016-10-20 08:01:43.593523493 -0400 @@ -3,7 +3,7 @@ from glob import glob from distutils.extension import Extension from sage.env import SAGE_LOCAL @@ -10,10 +10,22 @@ diff -up src/module_list.py.orig src/module_list.py ######################################################### ### pkg-config setup +diff -up src/sage/misc/cython.py.orig src/sage/misc/cython.py +--- src/sage/misc/cython.py.orig 2016-10-20 08:03:03.079526537 -0400 ++++ src/sage/misc/cython.py 2016-10-20 08:03:18.761527138 -0400 +@@ -433,7 +433,7 @@ extra_compile_args = %s + + ext_modules = [Extension('%s', sources=['%s.%s', %s], + libraries=%s, +- library_dirs=[SAGE_LOCAL + '/lib/'] + %s, ++ library_dirs=[os.path.realpath(SAGE_LOCAL + '/lib/')] + %s, + extra_compile_args = extra_compile_args, + language = '%s' )] + diff -up src/setup.py.orig src/setup.py ---- src/setup.py.orig 2016-08-08 13:19:09.383496590 -0400 -+++ src/setup.py 2016-08-08 13:20:41.161500105 -0400 -@@ -561,11 +561,9 @@ def run_cythonize(): +--- src/setup.py.orig 2016-10-20 08:01:54.264523902 -0400 ++++ src/setup.py 2016-10-20 08:02:33.449525402 -0400 +@@ -584,11 +584,9 @@ def run_cythonize(): print('Enabling Cython profiling support') profile = True @@ -26,8 +38,8 @@ diff -up src/setup.py.orig src/setup.py + Cython.Compiler.Main.default_options['cache'] = True force = True - version_file = os.path.join(os.path.dirname(__file__), '.cython_version') -@@ -618,21 +616,6 @@ print("Discovered Python/Cython sources, + version_file = os.path.join(SAGE_CYTHONIZED, '.cython_version') +@@ -641,21 +639,6 @@ print("Discovered Python/Cython sources, ######################################################### @@ -37,7 +49,7 @@ diff -up src/setup.py.orig src/setup.py -print('Cleaning up stale installed files....') -t = time.time() -from sage_setup.clean import clean_install_dir --output_dirs = SITE_PACKAGES + glob.glob(os.path.join(SAGE_SRC, 'build', 'lib*')) +-output_dirs = SITE_PACKAGES + glob.glob(os.path.join(build_base, 'lib*')) -for output_dir in output_dirs: - print('- cleaning {0}'.format(output_dir)) - clean_install_dir(output_dir, python_packages, python_modules, @@ -49,15 +61,3 @@ diff -up src/setup.py.orig src/setup.py ### Install also Jupyter kernel spec ######################################################### -diff -up src/sage/misc/cython.py.orig src/sage/misc/cython.py ---- src/sage/misc/cython.py.orig 2016-08-24 11:51:48.802265784 -0400 -+++ src/sage/misc/cython.py 2016-08-24 11:52:36.723267619 -0400 -@@ -426,7 +426,7 @@ extra_compile_args = %s - - ext_modules = [Extension('%s', sources=['%s.%s', %s], - libraries=%s, -- library_dirs=[SAGE_LOCAL + '/lib/'] + %s, -+ library_dirs=[os.path.realpath(SAGE_LOCAL + '/lib/')] + %s, - extra_compile_args = extra_compile_args, - language = '%s' )] - diff --git a/sagemath-sagedoc.patch b/sagemath-sagedoc.patch index dc2a6e1..2ca817a 100644 --- a/sagemath-sagedoc.patch +++ b/sagemath-sagedoc.patch @@ -1,7 +1,7 @@ diff -up src/doc/common/conf.py.orig src/doc/common/conf.py ---- src/doc/common/conf.py.orig 2016-08-08 13:21:49.624502727 -0400 -+++ src/doc/common/conf.py 2016-08-08 13:22:19.945503888 -0400 -@@ -218,7 +218,7 @@ if (os.environ.get('SAGE_DOC_MATHJAX', ' +--- src/doc/common/conf.py.orig 2016-10-20 08:03:49.618528319 -0400 ++++ src/doc/common/conf.py 2016-10-20 08:04:20.281529493 -0400 +@@ -217,7 +217,7 @@ if (os.environ.get('SAGE_DOC_MATHJAX', ' html_theme_options['mathjax_macros'] = sage_mathjax_macros() from pkg_resources import Requirement, working_set @@ -11,8 +11,8 @@ diff -up src/doc/common/conf.py.orig src/doc/common/conf.py # It would be really nice if sphinx would copy the entire mathjax directory, diff -up src/sage/doctest/control.py.orig src/sage/doctest/control.py ---- src/sage/doctest/control.py.orig 2016-08-08 13:22:48.247504971 -0400 -+++ src/sage/doctest/control.py 2016-08-08 13:23:38.842506909 -0400 +--- src/sage/doctest/control.py.orig 2016-10-20 08:03:49.619528319 -0400 ++++ src/sage/doctest/control.py 2016-10-20 08:04:20.283529494 -0400 @@ -95,7 +95,6 @@ class DocTestDefaults(SageObject): self.valgrind = False self.massif = False @@ -30,7 +30,7 @@ diff -up src/sage/doctest/control.py.orig src/sage/doctest/control.py # Non-interactive debuggers: 48 hours options.timeout = int(os.getenv('SAGE_TIMEOUT_VALGRIND', 48 * 60 * 60)) elif options.long: -@@ -636,7 +635,6 @@ class DocTestController(SageObject): +@@ -635,7 +634,6 @@ class DocTestController(SageObject): from sage.env import SAGE_SRC, SAGE_DOC_SRC, SAGE_ROOT def all_files(): self.files.append(opj(SAGE_SRC, 'sage')) @@ -38,7 +38,7 @@ diff -up src/sage/doctest/control.py.orig src/sage/doctest/control.py self.files.append(SAGE_DOC_SRC) self.options.sagenb = True DOT_GIT= opj(SAGE_ROOT, '.git') -@@ -1031,13 +1029,8 @@ class DocTestController(SageObject): +@@ -1030,13 +1028,8 @@ class DocTestController(SageObject): elif opt.cachegrind: toolname = "cachegrind" flags = os.getenv("SAGE_CACHEGRIND_FLAGS", "") @@ -52,7 +52,7 @@ diff -up src/sage/doctest/control.py.orig src/sage/doctest/control.py if "%s" in flags: flags %= toolname + ".%p" # replace %s with toolname cmd += flags + sage_cmd -@@ -1097,10 +1090,10 @@ class DocTestController(SageObject): +@@ -1096,10 +1089,10 @@ class DocTestController(SageObject): 0 """ opt = self.options @@ -66,9 +66,9 @@ diff -up src/sage/doctest/control.py.orig src/sage/doctest/control.py return self.run_val_gdb() else: diff -up src/sage/interfaces/singular.py.orig src/sage/interfaces/singular.py ---- src/sage/interfaces/singular.py.orig 2016-08-08 13:23:50.344507349 -0400 -+++ src/sage/interfaces/singular.py 2016-08-08 13:24:08.618508049 -0400 -@@ -2249,7 +2249,7 @@ def generate_docstring_dictionary(): +--- src/sage/interfaces/singular.py.orig 2016-10-20 08:03:49.621528319 -0400 ++++ src/sage/interfaces/singular.py 2016-10-20 08:04:20.286529494 -0400 +@@ -2258,7 +2258,7 @@ def generate_docstring_dictionary(): nodes.clear() node_names.clear() @@ -78,9 +78,9 @@ diff -up src/sage/interfaces/singular.py.orig src/sage/interfaces/singular.py new_node = re.compile("File: singular\.hlp, Node: ([^,]*),.*") new_lookup = re.compile("\* ([^:]*):*([^.]*)\..*") diff -up src/sage_setup/docbuild/ext/multidocs.py.orig src/sage_setup/docbuild/ext/multidocs.py ---- src/sage_setup/docbuild/ext/multidocs.py.orig 2016-08-10 14:37:02.566492810 -0400 -+++ src/sage_setup/docbuild/ext/multidocs.py 2016-08-10 14:37:31.238493908 -0400 -@@ -78,8 +78,11 @@ def merge_environment(app, env): +--- src/sage_setup/docbuild/ext/multidocs.py.orig 2016-10-20 08:03:49.622528319 -0400 ++++ src/sage_setup/docbuild/ext/multidocs.py 2016-10-20 08:04:20.287529494 -0400 +@@ -83,8 +83,11 @@ def merge_environment(app, env): for ind in newalldoc: # treat subdocument source as orphaned file and don't complain md = env.metadata.get(ind, dict()) @@ -95,8 +95,8 @@ diff -up src/sage_setup/docbuild/ext/multidocs.py.orig src/sage_setup/docbuild/e newcite = {} for ind, (path, tag) in docenv.citations.iteritems(): diff -up src/sage_setup/docbuild/__init__.py.orig src/sage_setup/docbuild/__init__.py ---- src/sage_setup/docbuild/__init__.py.orig 2016-08-10 14:33:38.854485009 -0400 -+++ src/sage_setup/docbuild/__init__.py 2016-08-10 14:34:22.591486684 -0400 +--- src/sage_setup/docbuild/__init__.py.orig 2016-10-20 08:04:16.858529362 -0400 ++++ src/sage_setup/docbuild/__init__.py 2016-10-20 08:04:20.288529494 -0400 @@ -295,12 +295,12 @@ class AllBuilder(object): # apply_async does not, so don't use it. x = pool.map_async(build_other_doc, L, 1) diff --git a/sagemath-scripts.patch b/sagemath-scripts.patch index d294074..73cf523 100644 --- a/sagemath-scripts.patch +++ b/sagemath-scripts.patch @@ -1,7 +1,24 @@ diff -up src/bin/sage.orig src/bin/sage ---- src/bin/sage.orig 2016-08-08 13:05:27.823465130 -0400 -+++ src/bin/sage 2016-08-08 13:12:27.114481186 -0400 -@@ -13,20 +13,16 @@ usage() { +--- src/bin/sage.orig 2016-12-30 06:31:16.930949819 -0500 ++++ src/bin/sage 2016-12-30 06:31:50.812950266 -0500 +@@ -1,5 +1,16 @@ + #!/usr/bin/env bash + ++# Display the Sage startup banner, used in src/bin/sage ++sage_banner() { ++ if [ "$SAGE_BANNER" = "bare" ]; then ++ cat "$SAGE_ROOT/VERSION.txt" ++ elif [ "$SAGE_BANNER" != "no" ]; then ++ # This file sage-banner is not yet available during the build ++ # of Sage, so we ignore errors from cat. ++ cat "$SAGE_LOCAL/bin/sage-banner" 2>/dev/null ++ fi ++} ++ + help_banner() { + sage_banner | grep -v 'Type' + echo +@@ -13,20 +24,16 @@ usage() { echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" echo " -advanced -- list all command line options" echo " -c -- Evaluates cmd as sage code" @@ -22,7 +39,7 @@ diff -up src/bin/sage.orig src/bin/sage echo " -python [...] -- run the Python interpreter" echo " -R [...] -- run Sage's R with given arguments" echo " -singular [...] -- run Sage's singular with given arguments" -@@ -42,10 +38,6 @@ usage() { +@@ -42,10 +49,6 @@ usage() { echo " --optional - controls which optional tests are run" echo " --sagenb - test all sagenb files" echo " --help - show all testing options" @@ -33,7 +50,7 @@ diff -up src/bin/sage.orig src/bin/sage echo " -v, -version -- display Sage version information" exit 0 } -@@ -64,11 +56,8 @@ usage_advanced() { +@@ -64,11 +67,8 @@ usage_advanced() { echo " -preparse -- preparse file.sage and produce corresponding file.sage.py" echo " -q -- quiet; start with no banner" echo " -root -- print the Sage root directory" @@ -45,7 +62,7 @@ diff -up src/bin/sage.orig src/bin/sage echo #### 1.......................26..................................................78 -@@ -78,8 +67,6 @@ usage_advanced() { +@@ -78,8 +78,6 @@ usage_advanced() { echo " 'default', 'sagenb', and 'jupyter'). See the output" echo " of sage --notebook --help for more details and" echo " examples of how to pass optional arguments" @@ -54,7 +71,7 @@ diff -up src/bin/sage.orig src/bin/sage echo " -inotebook [...] -- start the *insecure* Sage notebook (deprecated)" echo " -n, -notebook [...] -- start the default Sage notebook (options are the" echo " same as for the notebook command in Sage). See the" -@@ -98,12 +85,9 @@ usage_advanced() { +@@ -98,18 +96,12 @@ usage_advanced() { echo " -gp [...] -- run Sage's PARI/GP calculator with given arguments" echo " -ipython [...] -- run Sage's IPython using the default environment (not" echo " Sage), passing additional options to IPython" @@ -64,10 +81,16 @@ diff -up src/bin/sage.orig src/bin/sage echo " -lisp [...] -- run Lisp interpreter included with Sage" echo " -M2 [...] -- run Sage's Macaulay2 with given arguments" - command -v M2 &>/dev/null || \ - echo " (not installed currently, run sage -i macaulay2)" +- echo " (not installed currently, run sage -i macaulay2)" echo " -maxima [...] -- run Sage's Maxima with given arguments" echo " -mwrank [...] -- run Sage's mwrank with given arguments" -@@ -118,49 +102,7 @@ usage_advanced() { + echo " -polymake [...] -- run Sage's Polymake with given arguments" +- command -v polymake &>/dev/null || \ +- echo " (not installed currently, run sage -i polymake)" + echo " -python [...] -- run the Python interpreter" + echo " -R [...] -- run Sage's R with given arguments" + echo " -scons [...] -- run Sage's scons" +@@ -121,49 +113,7 @@ usage_advanced() { echo #### 1.......................26..................................................78 #### |.....................--.|...................................................| @@ -118,7 +141,7 @@ diff -up src/bin/sage.orig src/bin/sage echo " -startuptime [module] -- display how long each component of Sage takes to" echo " start up; optionally specify a module to get more" echo " details about that particular module" -@@ -190,7 +132,6 @@ usage_advanced() { +@@ -193,7 +143,6 @@ usage_advanced() { echo " -coverage -- give info about doctest coverage of files" echo " -coverageall -- give summary info about doctest coverage of all" echo " files in the Sage library" @@ -126,7 +149,7 @@ diff -up src/bin/sage.orig src/bin/sage echo " -search_src -- search through all the Sage library code for string" echo " -search_doc -- search through the Sage documentation for string" echo " -grep -- same as -search_src" -@@ -210,16 +151,6 @@ usage_advanced() { +@@ -213,16 +162,6 @@ usage_advanced() { echo #### 1.......................26..................................................78 #### |.....................--.|...................................................| @@ -143,7 +166,7 @@ diff -up src/bin/sage.orig src/bin/sage echo "Valgrind memory debugging:" echo " -cachegrind -- run Sage using Valgrind's cachegrind tool. The log" echo " files are named sage-cachegrind.PID can be found in" -@@ -233,9 +164,6 @@ usage_advanced() { +@@ -236,9 +175,6 @@ usage_advanced() { echo " -memcheck -- run Sage using Valgrind's memcheck tool. The log" echo " files are named sage-memcheck.PID can be found in" echo " $DOT_SAGE" @@ -153,7 +176,7 @@ diff -up src/bin/sage.orig src/bin/sage echo " -valgrind -- this is an alias for -memcheck" echo echo "You can also use -- before a long option, e.g., 'sage --optional'." -@@ -260,86 +188,6 @@ if [ "$1" = '--nodotsage' ]; then +@@ -263,87 +199,6 @@ if [ "$1" = '--nodotsage' ]; then exit $status fi @@ -237,10 +260,11 @@ diff -up src/bin/sage.orig src/bin/sage - exit 1 -fi - - +- if [ $# -gt 0 ]; then if [ "$1" = '-h' -o "$1" = '-?' -o "$1" = '-help' -o "$1" = '--help' ]; then -@@ -352,26 +200,12 @@ fi + usage +@@ -355,23 +210,10 @@ fi # Prepare for running Sage, either interactively or non-interactively. sage_setup() { @@ -255,19 +279,16 @@ diff -up src/bin/sage.orig src/bin/sage - echo >&2 '************************************************************************' - exit 1 - fi -- + # Display the startup banner (unless SAGE_BANNER is explictly "no") - if [ "$SAGE_BANNER" != "no" ]; then - # can be 'bare', or 'yes', or unspecified - echo "$SAGE_BANNER_TEXT" - fi + sage_banner - maybe_sage_location - if [ ! -d "$IPYTHONDIR" ]; then # make sure that $DOT_SAGE exists so that ipython will happily # create its config directories there. If DOT_SAGE doesn't -@@ -382,20 +216,6 @@ sage_setup() { +@@ -382,20 +224,6 @@ sage_setup() { } @@ -288,7 +309,7 @@ diff -up src/bin/sage.orig src/bin/sage # Start an interactive Sage session, this function never returns. interactive_sage() { sage_setup -@@ -467,7 +287,7 @@ fi +@@ -472,7 +300,7 @@ fi if [ "$1" = '-singular' -o "$1" = '--singular' ]; then shift @@ -297,7 +318,7 @@ diff -up src/bin/sage.orig src/bin/sage fi if [ "$1" = '-sqlite3' -o "$1" = '--sqlite3' ]; then -@@ -495,16 +315,6 @@ if [ "$1" = '-lisp' -o "$1" = '--lisp' ] +@@ -500,16 +328,6 @@ if [ "$1" = '-lisp' -o "$1" = '--lisp' ] exec ecl "$@" fi @@ -314,19 +335,7 @@ diff -up src/bin/sage.orig src/bin/sage if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then shift exec maxima "$@" -@@ -530,11 +340,6 @@ if [ "$1" = '-pip' -o "$1" = '--pip' ]; - exec pip "$@" - fi - --if [ "$1" = '-fix-pkg-checksums' -o "$1" = '--fix-pkg-checksums' ]; then -- shift -- exec sage-fix-pkg-checksums "$@" --fi -- - if [ "$1" = '-python' -o "$1" = '--python' ]; then - shift - exec python "$@" -@@ -555,11 +360,6 @@ if [ "$1" = '-git' -o "$1" = '--git' ]; +@@ -560,11 +378,6 @@ if [ "$1" = '-git' -o "$1" = '--git' ]; exec git "$@" fi @@ -338,7 +347,7 @@ diff -up src/bin/sage.orig src/bin/sage if [ "$1" = '-sh' -o "$1" = '--sh' ]; then # AUTHORS: # - Carl Witty and William Stein: initial version -@@ -679,20 +479,6 @@ EOF +@@ -684,20 +497,6 @@ EOF fi ##################################################################### @@ -359,7 +368,7 @@ diff -up src/bin/sage.orig src/bin/sage # File conversion ##################################################################### -@@ -710,11 +496,6 @@ fi +@@ -715,11 +514,6 @@ fi # Run Sage's versions of the standard Algebra/Geometry etc. software ##################################################################### @@ -371,7 +380,7 @@ diff -up src/bin/sage.orig src/bin/sage if [[ "$1" =~ ^--notebook=.* || "$1" =~ ^-n=.* || "$1" =~ ^-notebook=.* ]] ; then sage-cleaner &>/dev/null & exec sage-notebook "$@" -@@ -725,13 +506,6 @@ if [ "$1" = "-notebook" -o "$1" = '--not +@@ -730,13 +524,6 @@ if [ "$1" = "-notebook" -o "$1" = '--not exec sage-notebook "$@" fi @@ -385,7 +394,7 @@ diff -up src/bin/sage.orig src/bin/sage if [ "$1" = "-inotebook" -o "$1" = '--inotebook' ]; then shift sage-cleaner &>/dev/null & -@@ -750,38 +524,19 @@ if [ "$1" = '-grepdoc' -o "$1" = "--grep +@@ -755,31 +542,12 @@ if [ "$1" = '-grepdoc' -o "$1" = "--grep exit 0 fi @@ -418,15 +427,7 @@ diff -up src/bin/sage.orig src/bin/sage if [ ! -f "$DOT_SAGE"/init.sage ]; then echo >&2 "init.sage does not exist ... creating" touch "$DOT_SAGE"/init.sage - fi - SAGE_BANNER=no sage_setup - export PYTHONIOENCODING="utf-8" # Fix encoding for doctests -- if [ "$1" = '-tp' -o "$1" = '-btp' ]; then -+ if [ "$1" = '-tp' ]; then - shift - exec sage-runtests -p "$@" - else -@@ -790,16 +545,6 @@ if [ "$1" = '-t' -o "$1" = '-bt' -o "$1" +@@ -795,10 +563,7 @@ if [ "$1" = '-t' -o "$1" = '-bt' -o "$1" fi fi @@ -434,24 +435,14 @@ diff -up src/bin/sage.orig src/bin/sage - if [ "$1" = '-btnew' ]; then - build_sage - fi -- shift -- SAGE_BANNER=no sage_setup -- export PYTHONIOENCODING="utf-8" # Fix encoding for doctests -- exec sage-runtests --new "$@" --fi -- - if [ "$1" = '-testall' -o "$1" = "--testall" ]; then ++if [ "$1" = '-tnew' ]; then shift SAGE_BANNER=no sage_setup -@@ -814,133 +559,6 @@ if [ "$1" = '-c' ]; then - exec sage-eval "$@" + export PYTHONIOENCODING="utf-8" # Fix encoding for doctests +@@ -824,114 +589,6 @@ if [ "$1" = '--location' ]; then + exit 0 fi --if [ "$1" = '--location' ]; then -- maybe_sage_location -- exit 0 --fi -- - -install() { - maybe_sage_location @@ -560,24 +551,10 @@ diff -up src/bin/sage.orig src/bin/sage - exec python -m "sage_setup.docbuild" "$@" -fi - --if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then -- shift -- sage_setup -- if [ "$SAGE_DEBUG" = "no" ]; then -- gdb -x "$SAGE_LOCAL/bin/sage-gdb-commands" \ -- -args python "$SAGE_LOCAL/bin/sage-ipython" "$@" -i -- else -- cygdb "$SAGE_SRC/build" "$SAGE_SRC/sage" \ -- -- -x "$SAGE_LOCAL/bin/sage-gdb-commands" \ -- -args python "$SAGE_LOCAL/bin/sage-ipython" "$@" -i -- fi -- exit $? --fi -- - if [ "$1" = '-preparse' -o "$1" = "--preparse" ]; then + if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then shift - exec sage-preparse "$@" -@@ -975,21 +593,10 @@ if [ "$1" = '-callgrind' -o "$1" = "--ca + sage_setup +@@ -980,26 +637,11 @@ if [ "$1" = '-callgrind' -o "$1" = "--ca exec sage-callgrind "$@" fi @@ -597,11 +574,16 @@ diff -up src/bin/sage.orig src/bin/sage -fi - if [ $# -ge 1 ]; then - T=`echo "$1" | sed -e "s/.*\.//"` - if [ "$T" = "spkg" ]; then +- T=`echo "$1" | sed -e "s/.*\.//"` +- if [ "$T" = "spkg" ]; then +- install "$@" +- fi + SAGE_BANNER=no sage_setup + unset TERM # See Trac #12263 + exec sage-run "$@" diff -up src/bin/sage-runtests.orig src/bin/sage-runtests ---- src/bin/sage-runtests.orig 2016-08-08 13:12:45.999481909 -0400 -+++ src/bin/sage-runtests 2016-08-08 13:13:01.713482511 -0400 +--- src/bin/sage-runtests.orig 2016-12-30 06:31:16.938949819 -0500 ++++ src/bin/sage-runtests 2016-12-30 06:31:21.902949885 -0500 @@ -56,10 +56,6 @@ if __name__ == "__main__": help="run doctests using Valgrind's cachegrind tool. The log " "files are named sage-cachegrind.PID and can be found in " + @@ -614,8 +596,8 @@ diff -up src/bin/sage-runtests.orig src/bin/sage-runtests parser.add_option("-f", "--failed", action="store_true", default=False, help="doctest only those files that failed in the previous run") diff -up src/bin/sage-valgrind.orig src/bin/sage-valgrind ---- src/bin/sage-valgrind.orig 2016-08-08 13:13:12.399482920 -0400 -+++ src/bin/sage-valgrind 2016-08-08 13:13:37.233483871 -0400 +--- src/bin/sage-valgrind.orig 2016-12-30 06:31:16.945949819 -0500 ++++ src/bin/sage-valgrind 2016-12-30 06:31:21.903949885 -0500 @@ -1,16 +1,6 @@ #!/usr/bin/env bash diff --git a/sagemath-sympy.patch b/sagemath-sympy.patch index 3000d29..e0271bb 100644 --- a/sagemath-sympy.patch +++ b/sagemath-sympy.patch @@ -1,16 +1,16 @@ diff -up src/sage/env.py.orig src/sage/env.py ---- src/sage/env.py.orig 2016-08-08 13:45:28.136557046 -0400 -+++ src/sage/env.py 2016-08-08 13:46:17.426558934 -0400 +--- src/sage/env.py.orig 2016-10-20 08:14:08.087552003 -0400 ++++ src/sage/env.py 2016-10-20 08:14:40.929553260 -0400 @@ -89,7 +89,7 @@ _add_variable_or_fallback('HOSTNAME', _add_variable_or_fallback('LOCAL_IDENTIFIER','$HOSTNAME.%s'%os.getpid()) # bunch of sage directories and files -_add_variable_or_fallback('SAGE_ROOT', None) +_add_variable_or_fallback('SAGE_ROOT', '@@SAGE_ROOT@@') - _add_variable_or_fallback('SAGE_LOCAL', opj('$SAGE_ROOT', 'local')) + _add_variable_or_fallback('SAGE_LOCAL', None) _add_variable_or_fallback('SAGE_ETC', opj('$SAGE_LOCAL', 'etc')) _add_variable_or_fallback('SAGE_INC', opj('$SAGE_LOCAL', 'include')) -@@ -111,7 +111,7 @@ _add_variable_or_fallback('SAGE_CYTHONIZ +@@ -115,7 +115,7 @@ _add_variable_or_fallback('SAGE_PKGS', o _add_variable_or_fallback('SAGE_EXTCODE', opj('$SAGE_SHARE', 'sage', 'ext')) _add_variable_or_fallback('SAGE_LOGS', opj('$SAGE_ROOT', 'logs', 'pkgs')) _add_variable_or_fallback('SAGE_SPKG_INST', opj('$SAGE_LOCAL', 'var', 'lib', 'sage', 'installed')) diff --git a/sagemath.spec b/sagemath.spec index f68e3a5..a3c1db2 100644 --- a/sagemath.spec +++ b/sagemath.spec @@ -2,6 +2,9 @@ %bcond_without bundled_pari %bcond_with bundled_pexpect +%bcond_without bundled_ipython + +%bcond_without install_hack # for faster full rpm test builds %ifarch %{ix86} x86_64 @@ -35,8 +38,11 @@ %global elliptic_curves_pkg elliptic_curves-0.8 %global flintqs_pkg flintqs-1.0 %global graphs_pkg graphs-20151224 +%if %{with bundled_ipython} +%global ipython_pkg ipython-5.0.0 +%endif %if %{with bundled_pari} -%global pari_pkg pari-2.8-2771-gb70b447 +%global pari_pkg pari-2.8.0.alpha %endif %if %{with bundled_pexpect} %global pexpect_pkg pexpect-4.1.0 @@ -58,8 +64,8 @@ Name: sagemath Group: Applications/Engineering Summary: A free open-source mathematics software system -Version: 7.3 -Release: 7%{?dist} +Version: 7.4 +Release: 1%{?dist} # The file ${SAGE_ROOT}/COPYING.txt is the upstream license breakdown file # Additionally, every $files section has a comment with the license name # before files with that license @@ -174,13 +180,13 @@ Patch27: %{name}-includes.patch Patch28: %{name}-gcc6.patch # Use ipython3 (mostly a rediff from sagemath-6.8 sage/repl) -Patch29: %{name}-ipython3.patch +#Patch29: %{name}-ipython3.patch # Use atlas blas Patch30: %{name}-atlas.patch # Correct side effect of sagemath-ipython3 patch -Patch31: %{name}-is_in_terminal.patch +#Patch31: %{name}-is_in_terminal.patch # Update for python-flask-0.11.1 Patch32: %{name}-flask.patch @@ -256,7 +262,10 @@ BuildRequires: python-flask-autoindex BuildRequires: python-flask-babel BuildRequires: python-flask-openid BuildRequires: python-flask-silk +%if %{without bundled_ipython} BuildRequires: python-ipython +%endif +BuildRequires: python-future BuildRequires: python-matplotlib BuildRequires: python-networkx %if %{without bundled_pexpect} @@ -264,6 +273,7 @@ BuildRequires: python-pexpect %endif BuildRequires: python-pkgconfig BuildRequires: python-sphinx +BuildRequires: python-six BuildRequires: python-twisted BuildRequires: python-twisted-web BuildRequires: R @@ -319,14 +329,21 @@ Requires: python-flask-autoindex Requires: python-flask-babel Requires: python-flask-openid Requires: python-flask-silk +Requires: python-future +%if %{without bundled_ipython} Requires: python-ipython +%endif Requires: python-matplotlib Requires: python-networkx +Requires: python-pathlib2 %if %{without bundled_pexpect} Requires: python-pexpect %endif -Requires: python-sphinx +Requires: python-pickleshare +Requires: python-prompt_toolkit +Requires: python-six Requires: python-speaklater +Requires: python-sphinx Requires: python-twisted Requires: python-twisted-mail Requires: python-twisted-web @@ -610,6 +627,13 @@ pushd build/pkgs/graphs mv %{graphs_pkg} src popd +%if %{with bundled_ipython} +pushd build/pkgs/ipython + tar zxf ../../../upstream/%{ipython_pkg}.tar.gz + mv %{ipython_pkg} src +popd +%endif + %if %{with bundled_pari} pushd build/pkgs/pari tar zxf ../../../upstream/%{pari_pkg}.tar.gz @@ -645,10 +669,9 @@ pushd build/pkgs/rubiks tar jxf ../../../upstream/%{rubiks_pkg}.tar.bz2 mv %{rubiks_pkg} src pushd src - cp ../patches/dietz-mcube-Makefile dietz/mcube/Makefile - cp ../patches/dietz-solver-Makefile dietz/solver/Makefile - cp ../patches/dietz-cu2-Makefile dietz/cu2/Makefile - cp ../patches/reid-Makefile reid/Makefile + for diff in `ls ../patches/*.patch`; do + patch -p1 < $diff + done popd popd @@ -699,9 +722,9 @@ popd %patch26 %patch27 %patch28 -%patch29 +#%#patch29 %patch30 -%patch31 +#%#patch31 %patch32 %patch33 @@ -744,10 +767,14 @@ export SAGE_INC=%{_includedir} export SAGE_FORTRAN=%{_bindir}/gfortran export SAGE_FORTRAN_LIB=`gfortran --print-file-name=libgfortran.so` export DESTDIR=%{buildroot} +export SAGE_DEBUG=no # Use file in /tmp because there are issues with long pathnames export DOT_SAGE=/tmp/sage$$ mkdir -p $DOT_SAGE/tmp +# Avoid surprises due to change to src/build/temp.*$ARCH.*/... +export SAGE_CYTHONIZED=$SAGE_SRC/build/cythonized + # match system packages as sagemath packages mkdir -p $SAGE_ROOT $SAGE_LOCAL ln -sf %{_libdir} $SAGE_LOCAL/lib @@ -764,6 +791,13 @@ save_LOCAL=$SAGE_LOCAL export PATH=%{_builddir}/bin:$PATH export SAGE_LOCAL=%{_builddir} +%if %{with bundled_ipython} +pushd build/pkgs/ipython/src + %__python2 setup.py build + %__python2 setup.py install --root %{_builddir} +popd +%endif + %if %{with bundled_pari} # Build bundled pari-2.8 pushd build/pkgs/pari/src @@ -799,9 +833,12 @@ export PYTHONPATH=%{_builddir}%{python_sitearch}:$PYTHONPATH %if %{with cython_hack} cp -far %{python_sitearch}/Cython %{_builddir}%{python_sitearch} - PATCH=$PWD/build/pkgs/cython/patches/pxi_sys_path.patch + BASE=$PWD/build/pkgs/cython/patches/ pushd %{_builddir}%{python_sitearch} - patch -p1 < $PATCH + for PATCH in pxi_sys_path.patch + do + patch -p1 < $BASE/$PATCH + done # https://bugzilla.redhat.com/show_bug.cgi?id=1406533 sed -i 's/disallow/dissallow/' Cython/Compiler/Options.py popd @@ -861,6 +898,7 @@ export SAGE_PYTHONPATH=%{buildroot}%{SAGE_PYTHONPATH} export LD_LIBRARY_PATH=%{_builddir}/lib:$LD_LIBRARY_PATH %endif export DESTDIR=%{buildroot} +export SAGE_DEBUG=no export DOT_SAGE=/tmp/sage$$ mkdir -p $DOT_SAGE/tmp @@ -909,10 +947,13 @@ popd #------------------------------------------------------------------------ pushd src - # FIXME finishes but fails when exiting - # from sage.misc.randstate import current_randstate - # ImportError: No module named randstate - %__python2 -u setup.py install --root=%{buildroot} || : +%if %{without install_hack} + # FIXME tries to rebuild everything + %__python2 -u setup.py install --root=%{buildroot} +%else + mkdir -p %{buildroot}%{python_sitearch} + cp -far build/lib.linux-*/sage %{buildroot}%{python_sitearch} +%endif %if %{with docs} # install documentation sources rm -fr $SAGE_DOC/{common,en,fr} @@ -1069,6 +1110,12 @@ pushd build/pkgs/sagetex/src done popd +#------------------------------------------------------------------------ +%if %{with bundled_ipython} +mv %{_builddir}%{python_sitelib}/IPython %{buildroot}%{SAGE_PYTHONPATH} +mv %{_builddir}%{_bindir}/ip* %{buildroot}%{SAGE_LOCAL}/bin +%endif + #------------------------------------------------------------------------ cat > %{buildroot}%{_bindir}/sage << EOF #!/bin/bash -i @@ -1272,8 +1319,10 @@ ln -s libpari-gmp-2.8.so.0.0.0 %{buildroot}%{SAGE_ROOT}/lib/libpari.so perl -pi -e 's|(libdirs = cblas_library_dirs)|$1 + \["%{SAGE_ROOT}/lib"\]|;' %{buildroot}%{python_sitearch}/sage/misc/cython.py %endif +%if %{without install_hack} # remove sage_setup rm -r %{buildroot}%{python_sitearch}/sage_setup +%endif # pretend sagemath spkgs are installed to reduce number of errors # in doctests @@ -1386,6 +1435,9 @@ exit 0 %if %{with bundled_pari} %{SAGE_LOCAL}/bin/gp* %endif +%if %{with bundled_ipython} +%{SAGE_LOCAL}/bin/ip* +%endif %{SAGE_LOCAL}/bin/python %{SAGE_LOCAL}/bin/sage* %{SAGE_LOCAL}/include @@ -1415,9 +1467,14 @@ exit 0 # GPLv2+ %{SAGE_LOCAL}/bin/cysignals* %{python_sitearch}/sage +%if %{without install_hack} %{python_sitearch}/sage-*.egg-info +%endif %{python_sitearch}/cysignals %{python_sitearch}/cysignals-*.egg-info +%if %{with bundled_ipython} +%{SAGE_PYTHONPATH}/IPython +%endif #------------------------------------------------------------------------ %files data @@ -1611,6 +1668,9 @@ exit 0 ######################################################################## %changelog +* Fri Dec 30 2016 pcpa - 7.4-1 +- Update to sagemath 7.4 + * Tue Dec 20 2016 pcpa - 7.3.7 - Correct f24 to f25 upgrade, sagemath 6.8 to 7.3 (#1396848) diff --git a/sources b/sources index 54e40d4..d70973c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a289e955f9c94be3e4420ee86d8302a7 sage-7.3.tar.gz +SHA512 (sage-7.4.tar.gz) = e45d3b5617b190302e8fff9f281551d0b2c27710d860892d6511019272e2f80487e27ffe7dce6c1276da721817a8cbd7946fd5a2e32741e5cba1955496c1b041