[arch-commits] Commit in sagemath/trunk (15 files)

Antonio Rojas arojas at archlinux.org
Fri Aug 17 22:28:58 UTC 2018


    Date: Friday, August 17, 2018 @ 22:28:57
  Author: arojas
Revision: 372568

Update to 8.3

Added:
  sagemath/trunk/sagemath-cremona.patch
Modified:
  sagemath/trunk/PKGBUILD
  sagemath/trunk/latte-count.patch
  sagemath/trunk/package.patch
  sagemath/trunk/sagemath-env.patch
  sagemath/trunk/sagemath-gap-4.8.patch
  sagemath/trunk/sagemath-python3-notebook.patch
  sagemath/trunk/sagemath-singular-4.1.1.patch
  sagemath/trunk/sagemath-threejs.patch
Deleted:
  sagemath/trunk/jupyter-path.patch
  sagemath/trunk/sagemath-cddlib-094j.patch
  sagemath/trunk/sagemath-detect-igraph.patch
  sagemath/trunk/sagemath-ignore-warnings.patch
  sagemath/trunk/sagemath-lrs.patch
  sagemath/trunk/sagemath-networkx2.patch

---------------------------------+
 PKGBUILD                        |   86 +--
 jupyter-path.patch              |   22 
 latte-count.patch               |   26 -
 package.patch                   |   11 
 sagemath-cddlib-094j.patch      |  980 --------------------------------------
 sagemath-cremona.patch          |   31 +
 sagemath-detect-igraph.patch    |   21 
 sagemath-env.patch              |   43 +
 sagemath-gap-4.8.patch          |    2 
 sagemath-ignore-warnings.patch  |   25 
 sagemath-lrs.patch              |   22 
 sagemath-networkx2.patch        |  175 ------
 sagemath-python3-notebook.patch |    2 
 sagemath-singular-4.1.1.patch   |  814 +++++++++++++++++++++++++++++++
 sagemath-threejs.patch          |    6 
 15 files changed, 943 insertions(+), 1323 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-08-17 21:06:27 UTC (rev 372567)
+++ PKGBUILD	2018-08-17 22:28:57 UTC (rev 372568)
@@ -4,12 +4,11 @@
 # Contributor: Thomas Dziedzic <gostrc at gmail dot com>
 # Contributor: Osman Ugus <ugus11 at yahoo dot com>
 # Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
-# Special thanks to Nareto for moving the compile from the .install to the PKGBUILD
 
 pkgbase=sagemath
 pkgname=(sagemath sagemath-jupyter)
-pkgver=8.2
-pkgrel=14
+pkgver=8.3
+pkgrel=1
 pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
 arch=(x86_64)
 url="http://www.sagemath.org"
@@ -30,38 +29,44 @@
   'libfes: exhaustive search of solutions for boolean equations' 'python2-pynormaliz: Normaliz backend for polyhedral computations'
   'latte-integrale: integral point count in polyhedra' 'polymake: polymake backend for polyhedral computations'
   'shared_meataxe: faster matrix arithmetic over finite fields' 'openblas: faster linear algebra'
-  'sirocco: for computing the fundamental group of the complement of a plane curve'
+  'sirocco: for computing the fundamental group of the complement of a plane curve' 'primecount: faster prime_pi implementation'
   'three.js: alternative 3D plots engine' 'dot2tex: for displaying some diagrams'
   'python2-pip: to install optional packages with sage -pip')
 makedepends=(cython2 boost ratpoints symmetrica python2-jinja coin-or-cbc libhomfly libbraiding sirocco
-  mcqd coxeter bliss-graphs tdlib python2-pkgconfig shared_meataxe libfes)
+  mcqd coxeter bliss-graphs tdlib python2-pkgconfig shared_meataxe libfes primecount)
 source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
-        sagemath-env.patch package.patch latte-count.patch jupyter-path.patch sagemath-python3-notebook.patch test-optional.patch
-        r-no-readline.patch fes02.patch sagemath-threejs.patch sagemath-ignore-warnings.patch
-        sagemath-detect-igraph.patch sagemath-networkx2.patch sagemath-scipy-1.0.patch sagemath-lrs.patch
-        sagemath-singular-4.1.1.patch sagemath-lcalc-c++11.patch sagemath-gap-4.8.patch
+        sagemath-env.patch
+        package.patch
+        latte-count.patch
+        sagemath-python3-notebook.patch
+        test-optional.patch
+        r-no-readline.patch
+        fes02.patch
+        sagemath-threejs.patch
+        sagemath-cremona.patch
+        sagemath-scipy-1.0.patch
+        sagemath-singular-4.1.1.patch
+        sagemath-lcalc-c++11.patch
+        sagemath-gap-4.8.patch
         sagemath-cypari2.patch::"https://git.sagemath.org/sage.git/patch?id=da380b32"
-        sagemath-cddlib-094j.patch sagemath-eclib-20180710.patch)
-sha256sums=('41ba2c2dde7a02e1bb6880ae875d37ab058567cc26e760efe87eeb12188cd65b'
-            'b3c5f5c159d72ba7bc2b186b7b0e50a02b1ca60caef49b3857dbaad3da36b6fc'
-            'c41ae665499c6cd775d40bbe178f8786830b0931ee26bf11ee02f7d83bcc8107'
-            '0b680e674c11c47afa86162d8b49645620b8912722e08133d23357c29ca9310a'
-            '2cad308f8adbb6c54e6603fa22b2f0eb60f6f09248d5d015000c3932ac14f646'
-            '962ce805c87147212b21fc2ab0ac9af9bd0033942c7a6905b9906645b48e8a4f'
+        sagemath-cddlib-0.94j.patch::"https://git.sagemath.org/sage.git/patch?id=af0e6066"
+        sagemath-eclib-20180710.patch)
+sha256sums=('41fd0b4eb820f7a1274e12294b6fbdbbf60d0027bff98c22fdc84da140964929'
+            'f483a448c045aeff186bec4b402da8109fa12547ff36219a9aa427c2561ec8e5'
+            '960afe4fcbffe2762b66119b8f14355386ced0d8ee52b535d0dac1dba90d365b'
+            'ef265f88ceb6caf4aac2d86ea74850861d99a63d11c94fc52b2ce88053c26d1e'
+            'fc393ee5fbf507dfb76d6ad0e9193d74a954acb13f35a371bf91e11bbcb08244'
             '18edeafb01cc1ed7270c2dfb41a58717918680c98e8eada1858736acd65d92ba'
             'afd0952b9bb8f52fd428eae36cf719a58ff85a894baae88cbb2124e043768cc7'
             '7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94'
-            '2d13b15ad2d1511bb3d752a261497060a8901882b1c2fa9813219781b7a71d83'
-            'a4a6c87b46ff23b89608aca66d00427334502e8bfb5dfe68b94497d19be1c7ae'
-            'bfe49f0168fe0824f0eaf4ea793b08d5b3e43c4e3634eb5f664c70644a793a59'
-            '8253730940687992dd29d90d95bea7e2685bb4854db004090c8196ce92859b64'
+            '4722f9257f7b58a5dc8be2e9163ebba6d7b3ee011ff1ab9c0dbfb1330d367261'
+            'f801be68d043f317cc2a85a5ca059010b68eaeafa3bbf5c9148f2c154e2a707d'
             '17397b8e1843b013ef5d2e083369109f0719651edd8ef0c8493cb49e2bc4324a'
-            'c0f65534a845ba802de6196229159fe67fcc3f72f0cb1ce57d4ae5c9fe10282c'
-            '507bf761df222d1961d53ebeaf8e6a5a3dc2d7b9cb78748d71ed8cb1ee1c4ac6'
+            '600701ee849d296cef63fad2dbf57db4d6d6259e2e5e1415a7ceaa385d98d5b9'
             '5114c912f821900e5bfae1e2cfeb7984de946d0b23e1182b0bf15be1d803dfd0'
-            '6917cb74e50ae965ea8d7c39577e5f0a5068e4b6a67b53fc6f219149a7d06584'
+            'b2c9b9695c358f868c3868790382cf7d112092184ce08f5733524d406ec20cac'
             '94847fc033fd36bc59217c8484d4cf48d0640ff35bb5ca5ffba88a8158c6dd44'
-            '092a928b77c8bb1e23399f22be39f67797a0065954128b690ead6a09f9ce1e44'
+            '9a690bda83c280c0801f6d04353e8a909da80ccfee92e06d200ae6eb9be9a5a8'
             '182b0765d58494978bf27628bada8b42c95ef7eb2671b91ddf9c67608560c662')
 
 prepare(){
@@ -74,8 +79,6 @@
   patch -p0 -i ../sagemath-env.patch
 # don't list optional packages when running tests
   patch -p0 -i ../test-optional.patch
-# set jupyter path
-  patch -p0 -i ../jupyter-path.patch
 # fix freezes in R interface with readline 7 (Debian)
   patch -p1 -i ../r-no-readline.patch
 # use correct latte-count binary name
@@ -82,19 +85,8 @@
   patch -p1 -i ../latte-count.patch
 # make 'sage -notebook=jupyter' work with our python3 jupyter-notebook package
   patch -p1 -i ../sagemath-python3-notebook.patch
-# fix Cremona database detection
-  sed -e "s|is_package_installed('database_cremona_ellcurve')|os.path.exists('/usr/share/cremona/cremona.db')|" \
-   -i src/sage/databases/cremona.py
-# fix python-igraph detection
-  patch -p1 -i ../sagemath-detect-igraph.patch
-# fix lrs detection
-  patch -p1 -i ../sagemath-lrs.patch
-# adapt to networkx 2 changes
-  patch -p1 -i ../sagemath-networkx2.patch
 # fix three.js plotting backend
   patch -p1 -i ../sagemath-threejs.patch
-# don't show PARI stack size increase or GLPK warnings during doctesting (Debian)
-  patch -p1 -i ../sagemath-ignore-warnings.patch
 # remove deprecated scipy parameters
   patch -p1 -i ../sagemath-scipy-1.0.patch
 # fix build with Singular 4.1.1
@@ -109,14 +101,15 @@
 # Upstream patches  
 # fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
   patch -p1 -i ../fes02.patch
+# use Features to detect Cremona databases https://trac.sagemath.org/ticket/25825
+  patch -p1 -i ../sagemath-cremona.patch
 # update to cypari2 https://trac.sagemath.org/ticket/25813
   patch -p1 -i ../sagemath-cypari2.patch
 # port to cddlib 0.94j https://trac.sagemath.org/ticket/25344
-  patch -p1 -i ../sagemath-cddlib-094j.patch
+  patch -p1 -i ../sagemath-cddlib-0.94j.patch
 
 # use python2
-  sed -e 's|#!/usr/bin/env sage-python23|#!/usr/bin/env python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' \
-    -e 's|exec python\b|exec python2|' -i src/bin/*
+  sed -e 's|#!/usr/bin/env sage-python23|#!/usr/bin/env python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' -i src/bin/*
   sed -e 's|cython {OPT}|cython2 {OPT}|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
   sed -e 's|exec ipython\b|exec ipython2|' -e 's|exec pip\b|exec pip2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage
   sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
@@ -126,6 +119,7 @@
 build() {
   cd sage-$pkgver/src
 
+  export CC=gcc
   export SAGE_ROOT="$PWD"
   export SAGE_SRC="$PWD"
   python2 setup.py build
@@ -138,12 +132,12 @@
 
   export SAGE_ROOT="$PWD"
   export SAGE_LOCAL="/usr"
-  export JUPYTER_PATH="$pkgdir"/usr/share/jupyter
+  export SAGE_EXTCODE="$PWD"/ext
   python2 setup.py install --root="$pkgdir" --optimize=1
 
   mkdir -p "$pkgdir"/usr/bin
   cp bin/sage "$pkgdir"/usr/bin
-  for _i in arch-env cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran \
+  for _i in cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran ipynb2rst \
     ipython massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run \
     run-cython runtests startuptime.py sws2rst valgrind version.sh
   do
@@ -170,7 +164,11 @@
 
   export SAGE_ROOT="$PWD"
   export SAGE_LOCAL="/usr"
-  export JUPYTER_PATH="$pkgdir"/usr/share/jupyter
 
-  python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update()"
+  python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update(prefix='$pkgdir/usr')"
+# fix symlinks to assets
+  for _i in $(ls ext/notebook-ipython); do
+    rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i
+    ln -s /usr/share/sage/ext/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/
+  done
 }

Deleted: jupyter-path.patch
===================================================================
--- jupyter-path.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ jupyter-path.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,22 +0,0 @@
---- src/sage/repl/ipython_kernel/install.py.orig	2015-10-23 19:23:39.728456590 +0000
-+++ src/sage/repl/ipython_kernel/install.py	2015-10-23 19:24:00.965018978 +0000
-@@ -13,8 +13,7 @@
-     SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE,
-     SAGE_VERSION
- )
--from jupyter_core.paths import ENV_JUPYTER_PATH
--JUPYTER_PATH = ENV_JUPYTER_PATH[0]
-+JUPYTER_PATH = os.environ.get('JUPYTER_PATH') 
- 
- 
- class SageKernelSpec(object):
-@@ -225,7 +225,7 @@
-             sage: spec._symlink_resources()    # not tested
-         """
-         path = os.path.join(SAGE_EXTCODE, 'notebook-ipython')
--        for filename in os.listdir(path):
-+        for filename in os.listdir('ext/notebook-ipython'):
-             self.symlink(
-                 os.path.join(path, filename),
-                 os.path.join(self.kernel_dir, filename)
-

Modified: latte-count.patch
===================================================================
--- latte-count.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ latte-count.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -51,7 +51,7 @@
 index 066cedd401..302b39910d 100644
 --- a/src/sage/interfaces/latte.py
 +++ b/src/sage/interfaces/latte.py
-@@ -88,7 +88,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
+@@ -93,7 +93,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
          sage: n = count(cddin, cdd=True, verbose=True, raw_output=True)  # optional - latte_int
          This is LattE integrale ...
          ...
@@ -60,9 +60,9 @@
          ...
          Total Unimodular Cones: ...
          Maximum number of simplicial cones in memory at once: ...
-@@ -108,7 +108,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
-     from sage.misc.misc import SAGE_TMP
-     from sage.rings.integer import Integer
+@@ -112,7 +112,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
+     # Check that LattE is present
+     Latte().require()
  
 -    args = ['count']
 +    args = ['latte-count']
@@ -69,3 +69,21 @@
      if ehrhart_polynomial and multivariate_generating_function:
          raise ValueError
      if ehrhart_polynomial:
+diff --git a/src/sage/features/latte.py b/src/sage/features/latte.py
+index 63d227fd35..040a5cf1f9 100644
+--- a/src/sage/features/latte.py
++++ b/src/sage/features/latte.py
+@@ -10,10 +10,10 @@ from . import Executable, Feature, FeatureTestResult
+ 
+ class Latte_count(Executable):
+     r"""
+-    Feature for the executable ``count`` from the LattE suite.
++    Feature for the executable ``latte-count`` from the LattE suite.
+     """
+     def __init__(self):
+-        Executable.__init__(self, "count", executable="count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php")
++        Executable.__init__(self, "latte-count", executable="latte-count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php")
+ 
+ class Latte_integrate(Executable):
+     r"""
+

Modified: package.patch
===================================================================
--- package.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ package.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,8 +1,8 @@
 --- src/sage/misc/package.py.orig	2014-11-23 15:58:13.000000000 +0100
 +++ src/sage/misc/package.py	2015-01-22 20:32:25.651383902 +0100
-@@ -320,7 +320,7 @@
-         sage: for pkg in list_packages('pip', local=True):
-         ....:     assert not is_package_installed(pkg)
+@@ -328,7 +328,7 @@
+         Use the framework provided by :mod:`sage.features` to check
+         whether a library is installed and functional.
      """
 -    return any(p.split('-')[0] == package for p in installed_packages(exclude_pip))
 +    return True
@@ -13,7 +13,7 @@
 +++ src/sage_setup/optional_extension.py       2016-10-19 18:38:13.514765366 +0000
 @@ -21,8 +21,6 @@
  from distutils.extension import Extension
- from sage.misc.package import is_package_installed, list_packages
+ from sage.misc.package import list_packages
  
 -all_packages = list_packages(local=True)
 -
@@ -20,10 +20,11 @@
  
  class CythonizeExtension(Extension):
      """
-@@ -76,14 +74,7 @@
+@@ -76,15 +74,7 @@
          condition = kwds.pop("condition")
      except KeyError:
          pkg = kwds.pop("package")
+-        from sage.misc.package import is_package_installed
 -        try:
 -            pkginfo = all_packages[pkg]
 -        except KeyError:

Deleted: sagemath-cddlib-094j.patch
===================================================================
--- sagemath-cddlib-094j.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-cddlib-094j.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,980 +0,0 @@
-diff --git a/src/sage/geometry/polyhedron/backend_cdd.py b/src/sage/geometry/polyhedron/backend_cdd.py
-index 9e0ca53ba7b..8497741b0c4 100644
---- a/src/sage/geometry/polyhedron/backend_cdd.py
-+++ b/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -154,7 +154,9 @@ def _init_from_cdd_input(self, cdd_input_string, cmdline_arg='--all', verbose=Fa
-             ....:    [0.62, -1.38, 0.38],[0.144, -1.04, 0.04],
-             ....:    [0.1309090909, -1.0290909091, 0.04]]
-             sage: Polyhedron(point_list)
--            A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 14 vertices
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: *Error: Numerical inconsistency is found.  Use the GMP exact arithmetic.
-             sage: Polyhedron(point_list, base_ring=QQ)
-             A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 14 vertices
-         """
-@@ -286,7 +288,9 @@ def cdd_adjacencies():
-             else:
-                 n_cdd=n;
-             self._V_adjacency_matrix = matrix(ZZ, n, n, 0)
--            expect_in_cddout('begin')
-+            if not find_in_cddout('begin'):
-+                raise ValueError('Error while parsing cdd output: could not '
-+                                 'find "begin" after "Vertex graph"')
-             l = cddout.pop(0).split()
-             assert int(l[0]) == n_cdd, "Not enough V-adjacencies in cdd output?"
-             for i in range(n_cdd):
-@@ -309,7 +313,9 @@ def cdd_adjacencies():
-         if find_in_cddout('Facet graph'):
-             n = len(self._Hrepresentation);
-             self._H_adjacency_matrix = matrix(ZZ, n, n, 0)
--            expect_in_cddout('begin')
-+            if not find_in_cddout('begin'):
-+                raise ValueError('Error while parsing cdd output: could not '
-+                                 'find "begin" after "Facet graph"')
-             l = cddout.pop(0).split()
-             assert int(l[0]) == n, "Not enough H-adjacencies in cdd output?"
-             for i in range(n):
----
-diff --git a/src/sage/geometry/hasse_diagram.py b/src/sage/geometry/hasse_diagram.py
-index 9d336ce..c5bff21 100644
---- a/src/sage/geometry/hasse_diagram.py
-+++ b/src/sage/geometry/hasse_diagram.py
-@@ -44,7 +44,7 @@ def Hasse_diagram_from_incidences(atom_to_coatoms, coatom_to_atoms,
-       implementation will just return these two tuples as a tuple;
- 
-     - ``required_atoms`` -- list of atoms (default:None). Each
--      non-empty "face" requires at least on of the specified atoms
-+      non-empty "face" requires at least one of the specified atoms
-       present. Used to ensure that each face has a vertex.
- 
-     - ``key`` -- any hashable value (default: None). It is passed down
-diff --git a/src/sage/geometry/polyhedron/backend_cdd.py b/src/sage/geometry/polyhedron/backend_cdd.py
-index 8497741..85f6632 100644
---- a/src/sage/geometry/polyhedron/backend_cdd.py
-+++ b/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -1,6 +1,19 @@
--"""
-+# -*- coding: utf-8 -*-
-+r"""
- The cdd backend for polyhedral computations
- """
-+# ****************************************************************************
-+#       Copyright (C) 2011-2014 Volker Braun <vbraun.name at gmail.com>
-+#                     2018      Timo Kaufmann <timokau at zoho.com>
-+#                     2018      Julian Rüth <julian.rueth at fsfe.org>
-+#
-+# This program is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation, either version 2 of the License, or
-+# (at your option) any later version.
-+#                  https://www.gnu.org/licenses/
-+# ****************************************************************************
-+
- from __future__ import print_function
- from __future__ import absolute_import
- 
-@@ -13,12 +26,10 @@ from .base import Polyhedron_base
- from .base_QQ import Polyhedron_QQ
- from .base_RDF import Polyhedron_RDF
- 
--#########################################################################
- class Polyhedron_cdd(Polyhedron_base):
--    """
-+    r"""
-     Base class for the cdd backend.
-     """
--
-     def _init_from_Vrepresentation(self, vertices, rays, lines, verbose=False):
-         """
-         Construct polyhedron from V-representation data.
-@@ -49,8 +60,30 @@ class Polyhedron_cdd(Polyhedron_base):
-         """
-         from .cdd_file_format import cdd_Vrepresentation
-         s = cdd_Vrepresentation(self._cdd_type, vertices, rays, lines)
--        self._init_from_cdd_input(s, '--reps', verbose)
--
-+        s = self._run_cdd(s, '--redcheck', verbose=verbose)
-+        s = self._run_cdd(s, '--repall', verbose=verbose)
-+        self._init_from_cdd_output(s)
-+        if not self.base_ring().is_exact():
-+            # cdd's parser can not handle the full output of --repall, so we
-+            # need to extract the first block before we feed it back into cdd
-+            s = s.splitlines()
-+            s = s[:s.index('end')+1]
-+            s = '\n'.join(s)
-+            t = self._run_cdd(s, '--rep', verbose=verbose)
-+
-+            def parse(intro, data):
-+                count = int(data[0][0])
-+                if count != len(self._cdd_V_to_sage_V):
-+                    # Upstream claims that nothing can be done about these
-+                    # cases/that they are features not bugs. Imho, cddlib is
-+                    # not really suitable for automatic parsing of its output,
-+                    # the implementation backed by doubles has not really been
-+                    # optimized for numerical stability, and makes some
-+                    # somewhat random numerical choices. (But I am not an
-+                    # expert in that field by any means.) See also
-+                    # https://github.com/cddlib/cddlib/pull/7.
-+                    raise ValueError("polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data")
-+            Polyhedron_cdd._parse_block(t.splitlines(), 'V-representation', parse)
- 
-     def _init_from_Hrepresentation(self, ieqs, eqns, verbose=False):
-         """
-@@ -78,88 +111,32 @@ class Polyhedron_cdd(Polyhedron_base):
-         """
-         from .cdd_file_format import cdd_Hrepresentation
-         s = cdd_Hrepresentation(self._cdd_type, ieqs, eqns)
--        self._init_from_cdd_input(s, '--reps', verbose)
--
--
--    def _init_facet_adjacency_matrix(self, verbose=False):
--        """
--        Compute the facet adjacency matrix in case it has not been
--        computed during initialization.
--
--        INPUT:
--
--        - ``verbose`` -- boolean (default: ``False``). Whether to print
--          verbose output for debugging purposes.
--
--        EXAMPLES::
--
--            sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], backend='cdd', base_ring=QQ)
--            sage: '_H_adjacency_matrix' in p.__dict__
--            False
--            sage: p._init_facet_adjacency_matrix()
--            sage: p._H_adjacency_matrix
--            [0 1 1]
--            [1 0 1]
--            [1 1 0]
--        """
--        self._init_from_cdd_input(self.cdd_Hrepresentation(),
--                                  '--adjacency', verbose)
--
--
--    def _init_vertex_adjacency_matrix(self, verbose=False):
--        """
--        Compute the vertex adjacency matrix in case it has not been
--        computed during initialization.
--
--        INPUT:
--
--        - ``verbose`` -- boolean (default: ``False``). Whether to print
--          verbose output for debugging purposes.
--
--        EXAMPLES::
--
--            sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], backend='cdd', base_ring=QQ)
--            sage: '_V_adjacency_matrix' in p.__dict__
--            False
--            sage: p._init_vertex_adjacency_matrix()
--            sage: p._V_adjacency_matrix
--            [0 1 1]
--            [1 0 1]
--            [1 1 0]
--        """
--        self._init_from_cdd_input(self.cdd_Vrepresentation(),
--                                  '--adjacency', verbose)
--
--
--    def _init_from_cdd_input(self, cdd_input_string, cmdline_arg='--all', verbose=False):
--        """
--        Internal method: run cdd on a cdd H- or V-representation
--        and initialize ourselves with the output.
--
--        TESTS::
--
--            sage: p = Polyhedron(vertices=[[0,0,0],[1,0,0],[0,1,0],[0,0,1]],
--            ....:                backend='cdd', base_ring=QQ)
--            sage: from sage.geometry.polyhedron.cdd_file_format import cdd_Vrepresentation
--            sage: s = cdd_Vrepresentation('rational', [[0,0,1],[0,1,0],[1,0,0]], [], [])
--            sage: p._init_from_cdd_input(s)
--            sage: p.dim()
--            2
--
--            sage: point_list = [[0.132, -1.028, 0.028],[0.5, 0.5, -1.5],
--            ....:    [-0.5, 1.5, -0.5],[0.5, 0.5, 0.5],[1.5, -0.5, -0.5],
--            ....:    [-0.332, -0.332, -0.668],[-1.332, 0.668, 0.332],
--            ....:    [-0.932, 0.068, 0.932],[-0.38, -0.38, 1.38],
--            ....:    [-0.744, -0.12, 1.12],[-0.7781818182, -0.12, 0.9490909091],
--            ....:    [0.62, -1.38, 0.38],[0.144, -1.04, 0.04],
--            ....:    [0.1309090909, -1.0290909091, 0.04]]
--            sage: Polyhedron(point_list)
--            Traceback (most recent call last):
--            ...
--            ValueError: *Error: Numerical inconsistency is found.  Use the GMP exact arithmetic.
--            sage: Polyhedron(point_list, base_ring=QQ)
--            A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 14 vertices
--        """
-+        s = self._run_cdd(s, '--redcheck', verbose=verbose)
-+        s = self._run_cdd(s, '--repall', verbose=verbose)
-+        self._init_from_cdd_output(s)
-+        if not self.base_ring().is_exact():
-+            # cdd's parser can not handle the full output of --repall, so we
-+            # need to extract the first block before we feed it back into cdd
-+            s = s.splitlines()
-+            s = s[:s.index('end')+1]
-+            s = '\n'.join(s)
-+            t = self._run_cdd(s, '--rep', verbose=verbose)
-+
-+            def parse(intro, data):
-+                count = int(data[0][0])
-+                infinite_count = len([d for d in data[1:] if d[0] == '1' and all(c == '0' for c in d[1:])])
-+                if count - infinite_count != len(self._Hrepresentation):
-+                    # Upstream claims that nothing can be done about these
-+                    # cases/that they are features not bugs. Imho, cddlib is
-+                    # not really suitable for automatic parsing of its output,
-+                    # the implementation backed by doubles has not really been
-+                    # optimized for numerical stability, and makes some
-+                    # somewhat random numerical choices. (But I am not an
-+                    # expert in that field by any means.)
-+                    raise ValueError("polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data")
-+            Polyhedron_cdd._parse_block(t.splitlines(), 'H-representation', parse)
-+
-+    def _run_cdd(self, cdd_input_string, cmdline_arg, verbose=False):
-         if verbose:
-             print('---- CDD input -----')
-             print(cdd_input_string)
-@@ -175,157 +152,189 @@ class Polyhedron_cdd(Polyhedron_base):
-         if 'Error:' in ans + err:
-             # cdd reports errors on stdout and misc information on stderr
-             raise ValueError(ans.strip())
--        self._init_from_cdd_output(ans)
-+        return ans
-+
-+    @classmethod
-+    def _parse_block(cls, cddout, header, parser):
-+        r"""
-+        Parse a block of cdd data identified by ``header`` by invoking
-+        ``parser`` on it.
-+
-+        EXAMPLES::
- 
-+            sage: cddout = r'''
-+            ....: unrelated
-+            ....: HEADER
-+            ....: intro 0 1 2
-+            ....: begin
-+            ....: data 0 1 2
-+            ....: data 3 4 5
-+            ....: end
-+            ....: unrelated
-+            ....: '''.splitlines()
-+            sage: from sage.geometry.polyhedron.backend_cdd import Polyhedron_cdd
-+            sage: def parser(intro, data):
-+            ....:     print("INTRO:", intro)
-+            ....:     print("DATA:", data)
-+            sage: Polyhedron_cdd._parse_block(cddout, 'HEADER', parser)
-+            INTRO: [['intro', '0', '1', '2']]
-+            DATA: [['data', '0', '1', '2'], ['data', '3', '4', '5']]
- 
--    def _init_from_cdd_output(self, cdd_output_string):
-+        """
-+        try:
-+            block = cddout[cddout.index(header)+1:]
-+        except ValueError:
-+            # section is missing in the cdd output
-+            return
-+
-+        intro = block[:block.index('begin')]
-+        intro = [i.strip().split() for i in intro]
-+        data = block[block.index('begin')+1:block.index('end')]
-+        data = [d.strip().split() for d in data]
-+        parser(intro, data)
-+
-+    def _init_from_cdd_output(self, cddout):
-         """
-         Initialize ourselves with the output from cdd.
- 
-         TESTS::
- 
--            sage: from sage.geometry.polyhedron.cdd_file_format import cdd_Vrepresentation
--            sage: s = cdd_Vrepresentation('rational',[[0,0],[1,0],[0,1],[1,1]], [], [])
--            sage: from subprocess import Popen, PIPE
--            sage: cdd_proc = Popen(['cdd_both_reps_gmp', '--all'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
--            sage: ans, err = cdd_proc.communicate(input=s)
--            sage: p = Polyhedron(vertices = [[0,0],[1,0],[0,1],[1,1]], backend='cdd', base_ring=QQ)
--            sage: p._init_from_cdd_output(ans)
-+            sage: p = Polyhedron(vertices = [[0,0],[1,0],[0,1],[1,1]], backend='cdd', base_ring=QQ) # indirect doctest
-             sage: p.vertices()
-             (A vertex at (0, 0), A vertex at (1, 0), A vertex at (0, 1), A vertex at (1, 1))
-         """
--        cddout=cdd_output_string.splitlines()
--        suppressed_vertex = False   # whether cdd suppressed the vertex in output
--        parent = self.parent()
--
--        # nested function
--        def expect_in_cddout(expected_string):
--            l = cddout.pop(0).strip()
--            if l!=expected_string:
--                raise ValueError('Error while parsing cdd output: expected "'
--                                   +expected_string+'" but got "'+l+'".\n')
--        # nested function
--        def cdd_linearities():
--            l = cddout[0].split()
--            if l[0] != "linearity":
--                return []
--            cddout.pop(0)
--            assert len(l) == int(l[1])+2, "Not enough linearities given"
--            return [int(i)-1 for i in l[2:]]  # make indices pythonic
--
--        # nested function
--        def cdd_convert(string, base_ring=self.base_ring()):
--            """
--            Converts the cdd output string to a numerical value.
--            """
--            return [base_ring(x) for x in string.split()]
--
--        # nested function
--        def find_in_cddout(expected_string):
--            """
--            Find the expected string in a list of strings, and
--            truncates ``cddout`` to start at that point. Returns
--            ``False`` if search fails.
--            """
--            for pos in range(0,len(cddout)):
--                l = cddout[pos].strip();
--                if l==expected_string:
--                    # must not assign to cddout in nested function
--                    for i in range(0,pos+1):
--                        cddout.pop(0)
--                    return True
--            return False
--
--        if find_in_cddout('V-representation'):
-+        cddout = cddout.splitlines()
-+
-+        def parse_indices(count, cdd_indices, cdd_indices_to_sage_indices=None):
-+            cdd_indices = map(int, cdd_indices)
-+            if cdd_indices_to_sage_indices is None:
-+                cdd_indices_to_sage_indices = {i:i-1 for i in cdd_indices}
-+            if count < 0:
-+                assert cdd_indices_to_sage_indices is not None, "Did not expect negative counts here"
-+                count = -count
-+                cdd_indices = list(set(cdd_indices_to_sage_indices.keys()) - set(cdd_indices))
-+                assert count in [len(cdd_indices), len(cdd_indices) -1]
-+            assert count == len(cdd_indices)
-+            return [cdd_indices_to_sage_indices[i] for i in cdd_indices if cdd_indices_to_sage_indices[i] is not None]
-+
-+        def parse_linearities(intro):
-+            for entries in intro:
-+                if entries and entries.pop(0) == 'linearity':
-+                    return parse_indices(int(entries.pop(0)), entries)
-+            return []
-+
-+        def parse_H_representation(intro, data):
-+            if '_Hrepresentation' in self.__dict__:
-+                raise NotImplementedError("can not replace internal representation as this breaks caching")
-+            self._Hrepresentation = []
-+            # we drop some entries in cdd's output and this changes the numbering; this dict keeps track of that
-+            self._cdd_H_to_sage_H = {}
-+            equations = parse_linearities(intro)
-+            data[0].pop(2) # ignore data type, we know the base ring already
-+            count, dimension = map(int, data.pop(0))
-+            assert self.ambient_dim() == dimension - 1, "Unexpected ambient dimension"
-+            assert len(data) == count, "Unexpected number of lines"
-+            for i, line in enumerate(data):
-+                coefficients = map(self.base_ring(), line)
-+                if coefficients[0] != 0 and all([e == 0 for e in coefficients[1:]]):
-+                    # cddlib sometimes includes an implicit plane at infinity: 1 0 0 ... 0
-+                    # We do not care about this entry.
-+                    self._cdd_H_to_sage_H[i+1] = None
-+                    continue
-+
-+                self._cdd_H_to_sage_H[i+1] = len(self._Hrepresentation)
-+                if i in equations:
-+                    self.parent()._make_Equation(self, coefficients)
-+                else:
-+                    self.parent()._make_Inequality(self, coefficients)
-+
-+            self._Hrepresentation = tuple(self._Hrepresentation)
-+
-+        def parse_V_representation(intro, data):
-+            if '_Vrepresentation' in self.__dict__:
-+                raise NotImplementedError("can not replace internal representation as this breaks caching")
-             self._Vrepresentation = []
--            lines = cdd_linearities()
--            expect_in_cddout('begin')
--            l = cddout.pop(0).split()
--            assert self.ambient_dim() == int(l[1])-1,  "Different ambient dimension?"
--            suppressed_vertex = True
--            for i in range(int(l[0])):
--                l = cddout.pop(0).strip()
--                l_type = l[0]
--                l = l[1:]
-+            # we drop some entries in cdd's output and this changes the numbering; this dict keeps track of that
-+            self._cdd_V_to_sage_V = {}
-+            lines = parse_linearities(intro)
-+            data[0].pop(2) # ignore data type, we know the base ring already
-+            count, dimension = map(int, data.pop(0))
-+            assert self.ambient_dim() == dimension - 1, "Unexpected ambient dimension"
-+            assert len(data) == count, "Unexpected number of lines"
-+            has_vertex = False
-+            for i, line in enumerate(data):
-+                kind = line.pop(0)
-+                coefficients = map(self.base_ring(), line)
-+                self._cdd_V_to_sage_V[i+1] = len(self._Vrepresentation)
-                 if i in lines:
--                    parent._make_Line(self, cdd_convert(l));
--                elif l_type == '0':
--                    parent._make_Ray(self, cdd_convert(l));
-+                    self.parent()._make_Line(self, coefficients);
-+                elif kind == '0':
-+                    self.parent()._make_Ray(self, coefficients);
-                 else:
--                    parent._make_Vertex(self, cdd_convert(l));
--                    suppressed_vertex = False
--            if suppressed_vertex and self.n_Vrepresentation()>0:
--                # cdd does not output the vertex if it is only the origin
--                parent._make_Vertex(self, [0] * self.ambient_dim())
-+                    self.parent()._make_Vertex(self, coefficients)
-+                    has_vertex = True
-+            if len(self._Vrepresentation) and not has_vertex:
-+                # when the Polyhedron consists only of lines/rays from the
-+                # origin, cddlib does not output the single vertex at the
-+                # origin so we have to add it here as the Polyhedron class
-+                # expects it to be there.
-+                self.parent()._make_Vertex(self, [self.base_ring().zero()] * self.ambient_dim())
-             self._Vrepresentation = tuple(self._Vrepresentation)
--            expect_in_cddout('end')
- 
--        if find_in_cddout('H-representation'):
--            self._Hrepresentation = []
--            equations = cdd_linearities()
--            expect_in_cddout('begin')
--            l = cddout.pop(0).split()
--            assert self.ambient_dim() == int(l[1])-1, "Different ambient dimension?"
--            for i in range(int(l[0])):
--                l = cddout.pop(0)
--                if i in equations:
--                    parent._make_Equation(self, cdd_convert(l));
--                else:
--                    parent._make_Inequality(self, cdd_convert(l));
--            self._Hrepresentation = tuple(self._Hrepresentation)
--            expect_in_cddout('end')
--
--        # nested function
--        def cdd_adjacencies():
--            l = cddout.pop(0).split()
--            assert l[2] == ':', "Not a line of the adjacency data?"
--            return [int(i)-1 for i in l[3:]]
--
--        if find_in_cddout('Vertex graph'):
--            n = len(self._Vrepresentation);
--            if suppressed_vertex:
--                n_cdd=n-1;
--            else:
--                n_cdd=n;
--            self._V_adjacency_matrix = matrix(ZZ, n, n, 0)
--            if not find_in_cddout('begin'):
--                raise ValueError('Error while parsing cdd output: could not '
--                                 'find "begin" after "Vertex graph"')
--            l = cddout.pop(0).split()
--            assert int(l[0]) == n_cdd, "Not enough V-adjacencies in cdd output?"
--            for i in range(n_cdd):
--                for a in cdd_adjacencies():
--                    self._V_adjacency_matrix[i,a] = 1
-+        def parse_adjacency(intro, data, N, cdd_indices_to_sage_indices):
-+            ret = matrix(ZZ, N, N, 0)
-+            cdd_vertex_count = int(data.pop(0)[0])
-+            data.reverse()
-+            for adjacencies in data:
-+                assert adjacencies[2] == ':', "Not a line of adjacency data"
-+                cdd_vertex = int(adjacencies[0])
-+                count = int(adjacencies[1])
-+
-+                # cdd sometimes prints implicit adjacencies for the plane at
-+                # infinity at the end of the output (even though it's not part
-+                # of the V/H representation) so we ignore indices that we do
-+                # not know about.
-+                if cdd_vertex not in cdd_indices_to_sage_indices:
-+                    cdd_indices_to_sage_indices[cdd_vertex] = None
-+                v = cdd_indices_to_sage_indices[cdd_vertex]
-+                if v is None:
-+                    continue
-+                for w in parse_indices(count, adjacencies[3:], cdd_indices_to_sage_indices):
-+                    if w is None:
-+                        continue
-+                    ret[v, w] = 1
-+            return ret
-+
-+        def parse_vertex_adjacency(intro, data):
-+            if '_V_adjacency_matrix' in self.__dict__:
-+                raise NotImplementedError("can not replace internal representation as this breaks caching")
-+            N = len(self._Vrepresentation)
-+            self._V_adjacency_matrix = parse_adjacency(intro, data, N, self._cdd_V_to_sage_V)
-+            for i, v in enumerate(self._Vrepresentation):
-                 # cdd reports that lines are never adjacent to anything.
--                # I disagree, they are adjacent to everything!
--                if self._Vrepresentation[i].is_line():
--                    for j in range(n):
-+                # we disagree, they are adjacent to everything.
-+                if v.is_line():
-+                    for j in range(len(self._Vrepresentation)):
-                         self._V_adjacency_matrix[i,j] = 1
-                         self._V_adjacency_matrix[j,i] = 1
--                    self._V_adjacency_matrix[i,i] = 0
--            if suppressed_vertex: # cdd implied that there is only one vertex
--                for i in range(n-1):
--                    self._V_adjacency_matrix[i,n-1] = 1
--                    self._V_adjacency_matrix[n-1,i] = 1
-+                self._V_adjacency_matrix[i,i] = 0
-             self._V_adjacency_matrix.set_immutable()
--            expect_in_cddout('end')
--
--        if find_in_cddout('Facet graph'):
--            n = len(self._Hrepresentation);
--            self._H_adjacency_matrix = matrix(ZZ, n, n, 0)
--            if not find_in_cddout('begin'):
--                raise ValueError('Error while parsing cdd output: could not '
--                                 'find "begin" after "Facet graph"')
--            l = cddout.pop(0).split()
--            assert int(l[0]) == n, "Not enough H-adjacencies in cdd output?"
--            for i in range(n):
--                for a in cdd_adjacencies():
--                    self._H_adjacency_matrix[i,a] = 1
-+            self.vertex_adjacency_matrix.set_cache(self._V_adjacency_matrix)
-+
-+        def parse_facet_adjacency(intro, data):
-+            if '_H_adjacency_matrix' in self.__dict__:
-+                raise NotImplementedError("can not replace internal representation as this breaks caching")
-+            N = len(self._Hrepresentation)
-+            self._H_adjacency_matrix = parse_adjacency(intro, data, N, self._cdd_H_to_sage_H)
-             self._H_adjacency_matrix.set_immutable()
--            expect_in_cddout('end')
-+            self.facet_adjacency_matrix.set_cache(self._H_adjacency_matrix)
-+
-+        Polyhedron_cdd._parse_block(cddout, 'H-representation', parse_H_representation)
-+        Polyhedron_cdd._parse_block(cddout, 'V-representation', parse_V_representation)
-+        Polyhedron_cdd._parse_block(cddout, 'Facet adjacency', parse_facet_adjacency)
-+        Polyhedron_cdd._parse_block(cddout, 'Vertex adjacency', parse_vertex_adjacency)
- 
- 
--#########################################################################
- class Polyhedron_QQ_cdd(Polyhedron_cdd, Polyhedron_QQ):
-     """
-     Polyhedra over QQ with cdd
-@@ -350,7 +359,7 @@ class Polyhedron_QQ_cdd(Polyhedron_cdd, Polyhedron_QQ):
- 
-     _cdd_type = 'rational'
- 
--    _cdd_executable = 'cdd_both_reps_gmp'
-+    _cdd_executable = 'cddexec_gmp'
- 
-     def __init__(self, parent, Vrep, Hrep, **kwds):
-         """
-@@ -369,7 +378,6 @@ class Polyhedron_QQ_cdd(Polyhedron_cdd, Polyhedron_QQ):
-         Polyhedron_cdd.__init__(self, parent, Vrep, Hrep, **kwds)
- 
- 
--#########################################################################
- class Polyhedron_RDF_cdd(Polyhedron_cdd, Polyhedron_RDF):
-     """
-     Polyhedra over RDF with cdd
-@@ -392,7 +400,7 @@ class Polyhedron_RDF_cdd(Polyhedron_cdd, Polyhedron_RDF):
-     """
-     _cdd_type = 'real'
- 
--    _cdd_executable = 'cdd_both_reps'
-+    _cdd_executable = 'cddexec'
- 
-     def __init__(self, parent, Vrep, Hrep, **kwds):
-         """
-diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py
-index 34f0a3f..a8ca502 100644
---- a/src/sage/geometry/polyhedron/base.py
-+++ b/src/sage/geometry/polyhedron/base.py
-@@ -47,10 +47,9 @@ from sage.categories.sets_cat import EmptySetError
- #  * derive from Polyhedron_base
- #
- #  * you must implement _init_from_Vrepresentation and
--#    _init_from_Vrepresentationa
-+#    _init_from_Hrepresentation
- #
--#  * You might want to override _init_empty_polyhedron,
--#    _init_facet_adjacency_matrix, _init_vertex_adjacency_matrix, and
-+#  * You might want to override _init_empty_polyhedron and
- #    _make_polyhedron_face.
- #
- #  * You can of course also override any other method for which you
-diff --git a/src/sage/geometry/polyhedron/library.py b/src/sage/geometry/polyhedron/library.py
-index bbadbb3..2cdc728 100644
---- a/src/sage/geometry/polyhedron/library.py
-+++ b/src/sage/geometry/polyhedron/library.py
-@@ -1100,18 +1100,23 @@ class Polytopes():
- 
-         EXAMPLES::
- 
--            sage: td = polytopes.truncated_dodecahedron()   # long time - 6secs
--            sage: td.f_vector()                # long time
-+            sage: td = polytopes.truncated_dodecahedron()
-+            sage: td.f_vector()
-             (1, 60, 90, 32, 1)
--            sage: td.base_ring()               # long time
-+            sage: td.base_ring()
-             Number Field in sqrt5 with defining polynomial x^2 - 5
- 
--        A much faster implementation using floating point approximations::
-+        The faster implementation using floating point approximations does not
-+        work unfortunately, see https://github.com/cddlib/cddlib/pull/7 for a
-+        detailed discussion of this case::
- 
-             sage: td = polytopes.truncated_dodecahedron(exact=False)
--            sage: td.f_vector()
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
-+            sage: td.f_vector() # not tested
-             (1, 60, 90, 32, 1)
--            sage: td.base_ring()
-+            sage: td.base_ring() # not tested
-             Real Double Field
- 
-         Its faces are 20 triangles and 12 regular decagons::
-@@ -1323,21 +1328,25 @@ class Polytopes():
-             sage: ti.base_ring()               # long time
-             Number Field in sqrt5 with defining polynomial x^2 - 5
- 
--        A much faster implementation using floating point approximations::
-+        The faster implementation using floating point approximations does not
-+        work unfortunately::
- 
-             sage: ti = polytopes.truncated_icosidodecahedron(exact=False)
--            sage: ti.f_vector()
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
-+            sage: ti.f_vector() # not tested
-             (1, 120, 180, 62, 1)
--            sage: ti.base_ring()
-+            sage: ti.base_ring() # not tested
-             Real Double Field
- 
-         Its faces are 30 squares, 20 hexagons and 12 decagons::
- 
--            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 4)
-+            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 4) # long time
-             30
--            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 6)
-+            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 6) # long time
-             20
--            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 10)
-+            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 10) # long time
-             12
-         """
-         if base_ring is None and exact:
-@@ -1382,26 +1391,32 @@ class Polytopes():
- 
-         - ``backend`` -- the backend to use to create the polytope.
- 
--        EXAMPLES::
-+        EXAMPLES:
-+
-+        Unfortunately, no polyhedra backend supports the construction of the
-+        snub dodecahedron at the moment::
- 
-             sage: sd = polytopes.snub_dodecahedron()
--            sage: sd.f_vector()
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: *Error: Numerical inconsistency is found.  Use the GMP exact arithmetic.
-+            sage: sd.f_vector() # not tested
-             (1, 60, 150, 92, 1)
--            sage: sd.base_ring()
-+            sage: sd.base_ring() # not tested
-             Real Double Field
- 
-         Its faces are 80 triangles and 12 pentagons::
- 
--            sage: sum(1 for f in sd.faces(2) if len(f.vertices()) == 3)
-+            sage: sum(1 for f in sd.faces(2) if len(f.vertices()) == 3) # not tested
-             80
--            sage: sum(1 for f in sd.faces(2) if len(f.vertices()) == 5)
-+            sage: sum(1 for f in sd.faces(2) if len(f.vertices()) == 5) # not tested
-             12
-         """
-         if base_ring is None:
-             base_ring = RDF
-         phi = (1 + base_ring(5).sqrt()) / 2
--        xi = ((phi/2 + (phi - 5/27).sqrt()/2).nth_root(3) +
--              (phi/2 - (phi - 5/27).sqrt()/2).nth_root(3))
-+        xi = ((phi/2 + (phi - 5/27).sqrt()/2)**(~ZZ(3)) +
-+              (phi/2 - (phi - 5/27).sqrt()/2)**(~ZZ(3)))
- 
-         alpha = xi - 1 / xi
-         beta = xi * phi + phi**2 + phi / xi
-@@ -1549,14 +1564,18 @@ class Polytopes():
-             sage: gap                                # not tested - very long time
-             A 4-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5)^4 defined as the convex hull of 100 vertices
- 
--        Computation with approximated coordinates is much faster::
-+        Computation with approximated coordinates would be much faster but is
-+        not supported currently::
- 
-             sage: gap = polytopes.grand_antiprism(exact=False)
--            sage: gap
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
-+            sage: gap # not tested
-             A 4-dimensional polyhedron in RDF^4 defined as the convex hull of 100 vertices
--            sage: gap.f_vector()
-+            sage: gap.f_vector() # not tested
-             (1, 100, 500, 720, 320, 1)
--            sage: len(list(gap.bounded_edges()))
-+            sage: len(list(gap.bounded_edges())) # not tested
-             500
-         """
-         from itertools import product
-diff --git a/src/sage/libs/ppl.pyx b/src/sage/libs/ppl.pyx
-index 5366c74..e318e86 100644
---- a/src/sage/libs/ppl.pyx
-+++ b/src/sage/libs/ppl.pyx
-@@ -110,14 +110,11 @@ basis vectors::
-     sage: C_Polyhedron(gs)
-     A 4-dimensional polyhedron in QQ^5 defined as the convex hull of 120 points
- 
--The above computation (using PPL) finishes without noticeable delay (timeit
--measures it to be 90 microseconds on sage.math). Below we do the same
--computation with cddlib, which needs more than 3 seconds on the same
--hardware::
-+The same computation with cddlib which is slightly slower::
- 
-     sage: basis = list(range(5))
-     sage: gs = [ tuple(coeff) for coeff in Permutations(basis) ]
--    sage: Polyhedron(vertices=gs, backend='cdd')  # long time (3s on sage.math, 2011)
-+    sage: Polyhedron(vertices=gs, backend='cdd')
-     A 4-dimensional polyhedron in QQ^5 defined as the convex hull of 120 vertices
- 
- DIFFERENCES VS. C++
-diff --git a/src/sage/categories/finite_coxeter_groups.py b/src/sage/categories/finite_coxeter_groups.py
-index e0b2846..8395895 100644
---- a/src/sage/categories/finite_coxeter_groups.py
-+++ b/src/sage/categories/finite_coxeter_groups.py
-@@ -712,11 +712,15 @@ class FiniteCoxeterGroups(CategoryWithAxiom):
-                 If function is too slow, switching the base ring to
-                 :class:`RDF` will almost certainly speed things up.
- 
--            EXAMPLES::
-+            EXAMPLES:
-+
-+            Unfortunately, an inexact base ring can not always be used::
- 
-                 sage: W = CoxeterGroup(['H',3], base_ring=RDF)
-                 sage: W.permutahedron()
--                A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 120 vertices
-+                Traceback (most recent call last):
-+                ...
-+                ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
- 
-                 sage: W = CoxeterGroup(['I',7])
-                 sage: W.permutahedron()
-diff --git a/src/sage/geometry/polyhedron/backend_cdd.py b/src/sage/geometry/polyhedron/backend_cdd.py
-index 85f6632..aaae546 100644
---- a/src/sage/geometry/polyhedron/backend_cdd.py
-+++ b/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -115,6 +115,10 @@ class Polyhedron_cdd(Polyhedron_base):
-         s = self._run_cdd(s, '--repall', verbose=verbose)
-         self._init_from_cdd_output(s)
-         if not self.base_ring().is_exact():
-+            if len(self._Vrepresentation) == 0:
-+                # cdd (reasonably) refuses to handle empty polyhedra, so we
-+                # skip this check
-+                return
-             # cdd's parser can not handle the full output of --repall, so we
-             # need to extract the first block before we feed it back into cdd
-             s = s.splitlines()
-diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py
-index bae02d7..084ed43 100644
---- a/src/sage/graphs/generators/smallgraphs.py
-+++ b/src/sage/graphs/generators/smallgraphs.py
-@@ -4454,14 +4454,19 @@ def TruncatedIcosidodecahedralGraph():
-     and 180 edges. For more information, see the
-     :wikipedia:`Truncated_icosidodecahedron`.
- 
--    EXAMPLES::
-+    EXAMPLES:
-+
-+    Unfortunately, this graph can not be constructed currently, due to numerical issues::
- 
-         sage: g = graphs.TruncatedIcosidodecahedralGraph(); g
--        Truncated Icosidodecahedron: Graph on 120 vertices
--        sage: g.order(), g.size()
-+        Traceback (most recent call last):
-+        ...
-+        ValueError: *Error: Numerical inconsistency is found.  Use the GMP exact arithmetic.
-+        sage: g.order(), g.size() # not tested
-         (120, 180)
-     """
-     from sage.geometry.polyhedron.library import polytopes
-+    # note that dropping exact=False here makes the construction take forever
-     G = polytopes.icosidodecahedron(exact=False).truncation().graph()
-     G.name("Truncated Icosidodecahedron")
-     return G
--- 
-cgit v1.0-1-gd88e
-
-
-From c4048677393f7088d1aa9a2c1392ed95d809d31c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Julian=20R=C3=BCth?= <julian.rueth at fsfe.org>
-Date: Thu, 14 Jun 2018 12:00:27 +0200
-Subject: Relax cddlib sanity checks
-
-sometimes cddlib's output is useful even if it fails to transform back and forth
----
- src/sage/categories/finite_coxeter_groups.py |  9 ++---
- src/sage/geometry/polyhedron/backend_cdd.py  |  6 ++-
- src/sage/geometry/polyhedron/library.py      | 56 +++++++++++++---------------
- 3 files changed, 33 insertions(+), 38 deletions(-)
-
-diff --git a/src/sage/categories/finite_coxeter_groups.py b/src/sage/categories/finite_coxeter_groups.py
-index 8395895..78a89fd 100644
---- a/src/sage/categories/finite_coxeter_groups.py
-+++ b/src/sage/categories/finite_coxeter_groups.py
-@@ -712,15 +712,14 @@ class FiniteCoxeterGroups(CategoryWithAxiom):
-                 If function is too slow, switching the base ring to
-                 :class:`RDF` will almost certainly speed things up.
- 
--            EXAMPLES:
--
--            Unfortunately, an inexact base ring can not always be used::
-+            EXAMPLES::
- 
-                 sage: W = CoxeterGroup(['H',3], base_ring=RDF)
-                 sage: W.permutahedron()
--                Traceback (most recent call last):
-+                doctest:warning
-                 ...
--                ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
-+                UserWarning: This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.
-+                A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 120 vertices
- 
-                 sage: W = CoxeterGroup(['I',7])
-                 sage: W.permutahedron()
-diff --git a/src/sage/geometry/polyhedron/backend_cdd.py b/src/sage/geometry/polyhedron/backend_cdd.py
-index aaae546..64f3002 100644
---- a/src/sage/geometry/polyhedron/backend_cdd.py
-+++ b/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -82,7 +82,8 @@ class Polyhedron_cdd(Polyhedron_base):
-                     # somewhat random numerical choices. (But I am not an
-                     # expert in that field by any means.) See also
-                     # https://github.com/cddlib/cddlib/pull/7.
--                    raise ValueError("polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data")
-+                    from warnings import warn
-+                    warn("This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.")
-             Polyhedron_cdd._parse_block(t.splitlines(), 'V-representation', parse)
- 
-     def _init_from_Hrepresentation(self, ieqs, eqns, verbose=False):
-@@ -137,7 +138,8 @@ class Polyhedron_cdd(Polyhedron_base):
-                     # optimized for numerical stability, and makes some
-                     # somewhat random numerical choices. (But I am not an
-                     # expert in that field by any means.)
--                    raise ValueError("polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data")
-+                    from warnings import warn
-+                    warn("This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.")
-             Polyhedron_cdd._parse_block(t.splitlines(), 'H-representation', parse)
- 
-     def _run_cdd(self, cdd_input_string, cmdline_arg, verbose=False):
-diff --git a/src/sage/geometry/polyhedron/library.py b/src/sage/geometry/polyhedron/library.py
-index 2cdc728..1115978 100644
---- a/src/sage/geometry/polyhedron/library.py
-+++ b/src/sage/geometry/polyhedron/library.py
-@@ -1106,25 +1106,27 @@ class Polytopes():
-             sage: td.base_ring()
-             Number Field in sqrt5 with defining polynomial x^2 - 5
- 
--        The faster implementation using floating point approximations does not
--        work unfortunately, see https://github.com/cddlib/cddlib/pull/7 for a
--        detailed discussion of this case::
--
--            sage: td = polytopes.truncated_dodecahedron(exact=False)
--            Traceback (most recent call last):
--            ...
--            ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
--            sage: td.f_vector() # not tested
--            (1, 60, 90, 32, 1)
--            sage: td.base_ring() # not tested
--            Real Double Field
--
-         Its faces are 20 triangles and 12 regular decagons::
- 
-             sage: sum(1 for f in td.faces(2) if len(f.vertices()) == 3)
-             20
-             sage: sum(1 for f in td.faces(2) if len(f.vertices()) == 10)
-             12
-+
-+        The faster implementation using floating point approximations does not
-+        fully work unfortunately, see https://github.com/cddlib/cddlib/pull/7
-+        for a detailed discussion of this case::
-+
-+            sage: td = polytopes.truncated_dodecahedron(exact=False)
-+            doctest:warning
-+            ...
-+            UserWarning: This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.
-+            sage: td.f_vector()
-+            Traceback (most recent call last):
-+            ...
-+            KeyError: ...
-+            sage: td.base_ring()
-+            Real Double Field
-         """
-         if base_ring is None and exact:
-             from sage.rings.number_field.number_field import QuadraticField
-@@ -1328,25 +1330,21 @@ class Polytopes():
-             sage: ti.base_ring()               # long time
-             Number Field in sqrt5 with defining polynomial x^2 - 5
- 
--        The faster implementation using floating point approximations does not
--        work unfortunately::
-+        The implementation using floating point approximations is much faster::
- 
-             sage: ti = polytopes.truncated_icosidodecahedron(exact=False)
--            Traceback (most recent call last):
--            ...
--            ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
--            sage: ti.f_vector() # not tested
-+            sage: ti.f_vector()
-             (1, 120, 180, 62, 1)
--            sage: ti.base_ring() # not tested
-+            sage: ti.base_ring()
-             Real Double Field
- 
-         Its faces are 30 squares, 20 hexagons and 12 decagons::
- 
--            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 4) # long time
-+            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 4)
-             30
--            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 6) # long time
-+            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 6)
-             20
--            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 10) # long time
-+            sage: sum(1 for f in ti.faces(2) if len(f.vertices()) == 10)
-             12
-         """
-         if base_ring is None and exact:
-@@ -1564,18 +1562,14 @@ class Polytopes():
-             sage: gap                                # not tested - very long time
-             A 4-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5)^4 defined as the convex hull of 100 vertices
- 
--        Computation with approximated coordinates would be much faster but is
--        not supported currently::
-+        Computation with approximated coordinates is much faster::
- 
-             sage: gap = polytopes.grand_antiprism(exact=False)
--            Traceback (most recent call last):
--            ...
--            ValueError: polyhedron data is numerically complicated; cdd could not convert between inexact V and H representation without loss of data
--            sage: gap # not tested
-+            sage: gap
-             A 4-dimensional polyhedron in RDF^4 defined as the convex hull of 100 vertices
--            sage: gap.f_vector() # not tested
-+            sage: gap.f_vector()
-             (1, 100, 500, 720, 320, 1)
--            sage: len(list(gap.bounded_edges())) # not tested
-+            sage: len(list(gap.bounded_edges()))
-             500
-         """
-         from itertools import product
--- 
-cgit v1.0-1-gd88e

Added: sagemath-cremona.patch
===================================================================
--- sagemath-cremona.patch	                        (rev 0)
+++ sagemath-cremona.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -0,0 +1,31 @@
+diff --git a/src/sage/databases/cremona.py b/src/sage/databases/cremona.py
+index 3f8dd62..ed5726a 100644
+--- a/src/sage/databases/cremona.py
++++ b/src/sage/databases/cremona.py
+@@ -53,7 +53,7 @@ from sage.misc.prandom import randint
+ 
+ import sage.schemes.elliptic_curves.constructor as elliptic
+ from .sql_db import SQLDatabase, verify_column
+-from sage.misc.package import is_package_installed
++from sage.features.databases import DatabaseCremona
+ from sage.env import SAGE_SHARE
+ from sage.misc.all import walltime
+ 
+@@ -825,7 +825,7 @@ class MiniCremonaDatabase(SQLDatabase):
+             if N < self.largest_conductor():
+                 message = "There is no elliptic curve with label " + label \
+                     + " in the database"
+-            elif is_package_installed('database_cremona_ellcurve'):
++            elif DatabaseCremona().is_present():
+                 message = "There is no elliptic curve with label " + label \
+                     + " in the currently available databases"
+             else:
+@@ -1673,7 +1673,7 @@ def CremonaDatabase(name=None,mini=None,set_global=None):
+     if name is None and not set_global:
+         return _db
+     if set_global and name is None:
+-        if is_package_installed('database_cremona_ellcurve'):
++        if DatabaseCremona().is_present():
+             name = 'cremona'
+         else:
+             name = 'cremona mini'

Deleted: sagemath-detect-igraph.patch
===================================================================
--- sagemath-detect-igraph.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-detect-igraph.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,21 +0,0 @@
-diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py
-index 252984f..ce19682 100644
---- a/src/sage/graphs/generic_graph.py
-+++ b/src/sage/graphs/generic_graph.py
-@@ -8480,10 +8480,12 @@ class GenericGraph(GenericGraph_pyx):
-         if algorithm is None:
-             if vertex_bound:
-                 algorithm = "LP"
--            elif is_package_installed("python_igraph"):
--                algorithm = "igraph"
-             else:
--                algorithm = "FF"
-+                algorithm = "igraph"
-+                try:
-+                    import igraph
-+                except ImportError:
-+                    algorithm = "FF"
- 
-         if (algorithm == "FF"):
-             return self._ford_fulkerson(x,y, value_only=value_only, integer=integer, use_edge_labels=use_edge_labels)
-

Modified: sagemath-env.patch
===================================================================
--- sagemath-env.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-env.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -80,8 +80,8 @@
  # The compilers are set in order of priority by
  # 1) environment variables
 @@ -296,8 +296,9 @@
- export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
  export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
+ export SAGE_SPKG_SCRIPTS="$SAGE_LOCAL/var/lib/sage/scripts"
  export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
 -export SAGE_SRC="$SAGE_ROOT/src"
 -export SAGE_DOC_SRC="$SAGE_SRC/doc"
@@ -91,25 +91,48 @@
  export SAGE_DOC="$SAGE_SHARE/doc/sage"
  
  if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
-@@ -403,6 +403,9 @@
+@@ -403,29 +403,8 @@
      export SAGE_STARTUP_FILE
  fi
  
 +export LIBMTX="$DOT_SAGE/meataxe"
 +[[ -d $LIBMTX ]] || mkdir -p $LIBMTX # Create meataxe data dir
-+
- if [ "$PYTHON_EGG_CACHE" = "" ]; then
-     PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
-     export PYTHON_EGG_CACHE
-@@ -488,7 +488,6 @@
-         fi
+-if [ "$PYTHON_EGG_CACHE" = "" ]; then
+-    PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
+-    export PYTHON_EGG_CACHE
+-fi
+-
+-# Set PYTHONUSERBASE to avoid picking up non-Sage versions of
+-# Matplotlib, numpy, etc. See http://trac.sagemath.org/ticket/19612.
+-#
+-# For more history (it used to be PYTHONNOUSERSITE=yes which killed
+-# the ability to do "sage -pip install PACKAGE --user"), see
+-# http://trac.sagemath.org/ticket/14243 and
+-# http://trac.sagemath.org/ticket/18955.
+-
+-if [ "$PYTHONUSERBASE" = "" ]; then
+-    PYTHONUSERBASE="$DOT_SAGE/local"
+-    export PYTHONUSERBASE
+-fi
+-
+-if [ -n "$PYTHONHOME" ]; then
+-    >&2 echo "Warning: PYTHONHOME must not be set when running Sage, clearing env..."
+-    unset PYTHONHOME
+-fi
+-
+ LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
+ export LDFLAGS
+ 
+@@ -489,8 +489,6 @@
      fi
  fi
+
 -export MAXIMA_PREFIX="$SAGE_LOCAL"
+-export MAXIMA_USERDIR="$DOT_SAGE/maxima"
  
  PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
  
-@@ -608,9 +608,6 @@
+@@ -601,9 +601,6 @@
      LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
  fi
  
@@ -138,7 +161,7 @@
  
  try:
      sitepackages_dirs = site.getsitepackages()
-@@ -163,7 +163,7 @@
+@@ -164,7 +164,7 @@
  _add_variable_or_fallback('GRAPHS_DATA_DIR',  opj('$SAGE_SHARE','graphs'))
  _add_variable_or_fallback('ELLCURVE_DATA_DIR',opj('$SAGE_SHARE','ellcurves'))
  _add_variable_or_fallback('POLYTOPE_DATA_DIR',opj('$SAGE_SHARE','reflexive_polytopes'))

Modified: sagemath-gap-4.8.patch
===================================================================
--- sagemath-gap-4.8.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-gap-4.8.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -20,7 +20,7 @@
 index 7bffcfc00d..51dad178d5 100644
 --- a/src/sage/libs/gap/util.pyx
 +++ b/src/sage/libs/gap/util.pyx
-@@ -166,7 +166,7 @@ def gap_root():
+@@ -170,7 +170,7 @@ def gap_root():
      if os.path.exists(GAP_ROOT_DIR):
          return GAP_ROOT_DIR
      print('The gap-4.5.5.spkg (or later) seems to be not installed!')

Deleted: sagemath-ignore-warnings.patch
===================================================================
--- sagemath-ignore-warnings.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-ignore-warnings.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,25 +0,0 @@
-Description: Ignore warnings of PARI increasing the stack size when parsing doctests
- Since we can't patch PARI to not produce the warnings and we don't want to
- patch tons of doctests to expect the warnings, we patch the doctest parser
- to ignore them.
-Author: Tobias Hansen <thansen at debian.org>
---- sage/src/sage/doctest/parsing.py
-+++ sage/src/sage/doctest/parsing.py
-@@ -40,6 +40,8 @@
- 
- float_regex = re.compile('\s*([+-]?\s*((\d*\.?\d+)|(\d+\.?))([eE][+-]?\d+)?)')
- optional_regex = re.compile(r'(py2|py3|long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w)*))')
-+pari_stack_warning_regex = re.compile(r'\s*\*\*\*.*(Warning: increasing stack size to )\d+\.')
-+glpk_simplex_warning_regex = re.compile(r'(Long-step dual simplex will be used)')
- find_sage_prompt = re.compile(r"^(\s*)sage: ", re.M)
- find_sage_continuation = re.compile(r"^(\s*)\.\.\.\.:", re.M)
- random_marker = re.compile('.*random', re.I)
-@@ -935,6 +936,8 @@
-             <type 'float'>
-         """
-         got = self.human_readable_escape_sequences(got)
-+        got = pari_stack_warning_regex.sub('', got)
-+        got = glpk_simplex_warning_regex.sub('', got)
-         if isinstance(want, MarkedOutput):
-             if want.random:
-                 return True

Deleted: sagemath-lrs.patch
===================================================================
--- sagemath-lrs.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-lrs.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,22 +0,0 @@
-diff --git a/src/sage/game_theory/normal_form_game.py b/src/sage/game_theory/normal_form_game.py
-index 2115de6800..da94aa5d45 100644
---- a/src/sage/game_theory/normal_form_game.py
-+++ b/src/sage/game_theory/normal_form_game.py
-@@ -621,6 +621,7 @@ from sage.matrix.constructor import vector
- from sage.misc.package import is_package_installed, PackageNotFoundError
- from sage.misc.temporary_file import tmp_filename
- from sage.numerical.mip import MixedIntegerLinearProgram
-+import os
- 
- try:
-     from gambit import Game
-@@ -1636,7 +1637,7 @@ class NormalFormGame(SageObject, MutableMapping):
-         if not algorithm:
-             if self.is_constant_sum():
-                 algorithm = "lp"
--            elif is_package_installed('lrslib'):
-+            elif os.path.exists('/usr/bin/lrsnash'):
-                 algorithm = "lrs"
-             else:
-                 algorithm = "enumeration"
-

Deleted: sagemath-networkx2.patch
===================================================================
--- sagemath-networkx2.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-networkx2.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,175 +0,0 @@
-diff --git a/src/sage/graphs/base/graph_backends.pyx b/src/sage/graphs/base/graph_backends.pyx
-index ff1d02900a..bad4a18539 100644
---- a/src/sage/graphs/base/graph_backends.pyx
-+++ b/src/sage/graphs/base/graph_backends.pyx
-@@ -800,9 +800,9 @@ class NetworkXGraphDeprecated(SageObject):
-             sage: X.multiedges = True
-             sage: G = X.mutate()
-             sage: G.edges()
--            [(1, 2), (2, 3)]
-+            MultiEdgeDataView([(1, 2), (2, 3)])
-             sage: G.edges(data=True)
--            [(1, 2, {'weight': 7}), (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})]
-+            MultiEdgeDataView([(1, 2, {'weight': 7}), (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})])
- 
-         """
-         import networkx
-@@ -868,11 +868,9 @@ class NetworkXDiGraphDeprecated(SageObject):
-             sage: X.multiedges = True
-             sage: G = X.mutate()
-             sage: G.edges()
--            [(1, 2), (2, 1), (2, 3)]
-+            OutMultiEdgeDataView([(1, 2), (2, 1), (2, 3)])
-             sage: G.edges(data=True)
--            [(1, 2, {'weight': 7}),
--             (2, 1, {7: {}, 8: {}}),
--             (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})]
-+            OutMultiEdgeDataView([(1, 2, {'weight': 7}), (2, 1, {8: {}, 7: {}}), (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})])
- 
-         """
-         import networkx
-@@ -1154,7 +1152,7 @@ class NetworkXGraphBackend(GenericGraphBackend):
-         import networkx
-         try:
-             if self._nxg.is_multigraph():
--                for k,d in self._nxg.edge[u][v].iteritems():
-+                for u0,v0,k,d in self._nxg.edges([u,v],True,keys=True):
-                     if d.get('weight',None) == l:
-                         self._nxg.remove_edge(u,v,k)
-                         break
-@@ -1223,7 +1221,7 @@ class NetworkXGraphBackend(GenericGraphBackend):
-         """
-         cdef dict E
-         try:
--            E = self._nxg.edge[u][v]
-+            E = self._nxg.edges[u,v,0]
-         except KeyError:
-             from networkx import NetworkXError
-             raise NetworkXError("Edge (%s,%s) requested via get_edge_label does not exist."%(u,v))
-@@ -1412,7 +1410,7 @@ class NetworkXGraphBackend(GenericGraphBackend):
-             sage: G.iterator_nbrs(0)
-             <dictionary-keyiterator object at ...>
-         """
--        return self._nxg.neighbors_iter(v)
-+        return self._nxg.neighbors(v)
- 
-     def iterator_in_nbrs(self, v):
-         """
-diff --git a/src/sage/graphs/digraph.py b/src/sage/graphs/digraph.py
-index 003a8d6bcb..986137a9b0 100644
---- a/src/sage/graphs/digraph.py
-+++ b/src/sage/graphs/digraph.py
-@@ -755,7 +755,7 @@ class DiGraph(GenericGraph):
-             self.allow_multiple_edges(multiedges,check=False)
-             self.allow_loops(loops,check=False)
-             self.add_vertices(data.nodes())
--            self.add_edges((u,v,r(l)) for u,v,l in data.edges_iter(data=True))
-+            self.add_edges((u,v,r(l)) for u,v,l in data.edges(data=True))
-         elif format == 'igraph':
-             if not data.is_directed():
-                 raise ValueError("A *directed* igraph graph was expected. To "+
-@@ -2846,7 +2846,7 @@ class DiGraph(GenericGraph):
-         Using the NetworkX implementation ::
- 
-             sage: D.topological_sort(implementation = "NetworkX")
--            [4, 5, 6, 9, 0, 1, 2, 3, 7, 8, 10]
-+            [4, 5, 6, 9, 0, 3, 2, 7, 1, 8, 10]
- 
-         Using the NetworkX recursive implementation ::
- 
-@@ -2872,9 +2872,7 @@ class DiGraph(GenericGraph):
-               sage: D = DiGraph({ 0:[1,2,3], 4:[2,5], 1:[8], 2:[7], 3:[7],
-               ....:   5:[6,7], 7:[8], 6:[9], 8:[10], 9:[10] })
-               sage: N = D.networkx_graph()
--              sage: networkx.topological_sort(N)
--              [4, 5, 6, 9, 0, 1, 2, 3, 7, 8, 10]
--              sage: networkx.topological_sort_recursive(N)
-+              sage: list(networkx.topological_sort(N))
-               [4, 5, 6, 9, 0, 3, 2, 7, 1, 8, 10]
- 
-         TESTS:
-@@ -2897,10 +2895,7 @@ class DiGraph(GenericGraph):
- 
-         elif implementation == "NetworkX" or implementation == "recursive":
-             import networkx
--            if implementation == "NetworkX":
--                S = networkx.topological_sort(self.networkx_graph(copy=False))
--            else:
--                S = networkx.topological_sort_recursive(self.networkx_graph(copy=False))
-+            S = list(networkx.topological_sort(self.networkx_graph(copy=False)))
-             if S is None:
-                 raise TypeError('Digraph is not acyclic; there is no topological sort.')
-             else:
-diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py
-index 8f81333685..1540ec0dcc 100644
---- a/src/sage/graphs/generators/families.py
-+++ b/src/sage/graphs/generators/families.py
-@@ -197,7 +197,7 @@ def BalancedTree(r, h):
-     gracefully::
- 
-         sage: graphs.BalancedTree(1, 10)
--        Balanced tree: Graph on 2 vertices
-+        Balanced tree: Graph on 11 vertices
- 
-         sage: graphs.BalancedTree(-1, 10)
-         Balanced tree: Graph on 1 vertex
-@@ -208,9 +208,6 @@ def BalancedTree(r, h):
-         sage: graphs.BalancedTree(3, 0)
-         Balanced tree: Graph on 1 vertex
- 
--        sage: graphs.BalancedTree(5, -2)
--        Balanced tree: Graph on 0 vertices
--
-         sage: graphs.BalancedTree(-2,-2)
-         Balanced tree: Graph on 0 vertices
-     """
-diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py
-index 3550f990ef..490813e619 100644
---- a/src/sage/graphs/graph.py
-+++ b/src/sage/graphs/graph.py
-@@ -1199,7 +1199,7 @@ class Graph(GenericGraph):
-             self.allow_loops(loops, check=False)
-             self.allow_multiple_edges(multiedges, check=False)
-             self.add_vertices(data.nodes())
--            self.add_edges((u,v,r(l)) for u,v,l in data.edges_iter(data=True))
-+            self.add_edges((u,v,r(l)) for u,v,l in data.edges(data=True))
-         elif format == 'igraph':
-             if data.is_directed():
-                 raise ValueError("An *undirected* igraph graph was expected. "+
-@@ -4621,7 +4621,7 @@ class Graph(GenericGraph):
- 
-             sage: g = Graph([(0,1,0), (1,2,999), (2,3,-5)])
-             sage: g.matching(use_edge_labels=True)
--            [(1, 2, 999)]
-+            [(0, 1, 0), (2, 3, -5)]
-             sage: g.matching(algorithm="LP", use_edge_labels=True)
-             [(1, 2, 999)]
- 
-@@ -4671,7 +4671,7 @@ class Graph(GenericGraph):
-             else:
-                 for u, v in L:
-                     g.add_edge(u, v)
--            d = networkx.max_weight_matching(g)
-+            d = dict(networkx.max_weight_matching(g).union(t[::-1] for t in networkx.max_weight_matching(g)))
-             if value_only:
-                 if use_edge_labels:
-                     return sum(W[u, v] for u, v in six.iteritems(d) if u < v)
-@@ -6305,7 +6305,7 @@ class Graph(GenericGraph):
-         return networkx.number_of_cliques(self.networkx_graph(copy=False), vertices, cliques)
- 
-     @doc_index("Clique-related methods")
--    def cliques_get_max_clique_graph(self, name=''):
-+    def cliques_get_max_clique_graph(self):
-         """
-         Return the clique graph.
- 
-@@ -6336,7 +6336,7 @@ class Graph(GenericGraph):
-             sage: (G.cliques_get_max_clique_graph()).show(figsize=[2,2])
-         """
-         import networkx
--        return Graph(networkx.make_max_clique_graph(self.networkx_graph(copy=False), name=name, create_using=networkx.MultiGraph()))
-+        return Graph(networkx.make_max_clique_graph(self.networkx_graph(copy=False), create_using=networkx.MultiGraph()))
- 
-     @doc_index("Clique-related methods")
-     def cliques_get_clique_bipartite(self, **kwds):
-

Modified: sagemath-python3-notebook.patch
===================================================================
--- sagemath-python3-notebook.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-python3-notebook.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -16,7 +16,7 @@
 index 3912b8cdf5..bd40cdadda 100644
 --- a/src/sage/repl/ipython_kernel/install.py
 +++ b/src/sage/repl/ipython_kernel/install.py
-@@ -280,7 +280,6 @@ def have_prerequisites(debug=True):
+@@ -289,7 +289,6 @@ def have_prerequisites(debug=True):
          True
      """
      try:

Modified: sagemath-singular-4.1.1.patch
===================================================================
--- sagemath-singular-4.1.1.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-singular-4.1.1.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,5 +1,16 @@
+From 426644f6d085e053fa0fcf3457702eac685b7cba Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Sat, 7 Jul 2018 00:37:37 +0200
+Subject: Adapt to singular 4.1.1 API changes
+
+---
+ src/sage/libs/singular/decl.pxd                          |  4 ++--
+ .../rings/polynomial/multi_polynomial_libsingular.pyx    | 16 ++++++++--------
+ src/sage/rings/polynomial/plural.pyx                     |  4 ++--
+ 3 files changed, 12 insertions(+), 12 deletions(-)
+
 diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
-index 676544ab1e..5c8639d362 100644
+index 4b658c4..84476a9 100644
 --- a/src/sage/libs/singular/decl.pxd
 +++ b/src/sage/libs/singular/decl.pxd
 @@ -170,7 +170,7 @@ cdef extern from "singular/Singular/libsingular.h":
@@ -21,7 +32,7 @@
      # return the i-th power of p; p destroyed, requires global ring
  
 diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
-index 089524d6b4..ce6d58fc6f 100644
+index 2a8d9ae..f2a11a8 100644
 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
 +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
 @@ -190,8 +190,8 @@ from sage.libs.singular.decl cimport (
@@ -35,7 +46,7 @@
      p_IsUnit, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
      p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
      idLift, IDELEMS, On, Off, SW_USE_CHINREM_GCD, SW_USE_EZGCD,
-@@ -1692,8 +1697,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_generic):
+@@ -1693,8 +1693,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
          if not g._poly:
              raise ZeroDivisionError
  
@@ -46,7 +57,7 @@
          if coeff:
              if r.cf.type == n_unknown or r.cf.cfDivBy(p_GetCoeff(f._poly, r), p_GetCoeff(g._poly, r), r.cf):
                  n = r.cf.cfDiv( p_GetCoeff(f._poly, r) , p_GetCoeff(g._poly, r), r.cf)
-@@ -1852,8 +1857,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_generic):
+@@ -1853,8 +1853,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
                     and (<MPolynomial_libsingular>g) \
                     and g.parent() is self \
                     and p_LmDivisibleBy((<MPolynomial_libsingular>g)._poly, m, r):
@@ -57,7 +68,7 @@
                  #p_SetCoeff(flt, n_Div( p_GetCoeff(f._poly, r) , p_GetCoeff((<MPolynomial_libsingular>g)._poly, r), r), r)
                  p_SetCoeff(flt, n_Init(1, r), r)
                  return new_MP(self,flt), g
-@@ -4049,10 +4054,10 @@ cdef class MPolynomial_libsingular(MPolynomial):
+@@ -4055,10 +4055,10 @@ cdef class MPolynomial_libsingular(MPolynomial):
              if _right.is_monomial():
                  p = _self._poly
                  quo = p_ISet(0,r)
@@ -71,10 +82,10 @@
                          quo = p_Add_q(quo, temp, r)
                      p = pNext(p)
 diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
-index 3b45a38419..c0227fd364 100644
+index d5439f7f..ad20ebc 100644
 --- a/src/sage/rings/polynomial/plural.pyx
 +++ b/src/sage/rings/polynomial/plural.pyx
-@@ -999,7 +999,7 @@ cdef class NCPolynomialRing_plural(Ring):
+@@ -998,7 +998,7 @@ cdef class NCPolynomialRing_plural(Ring):
          if not g._poly:
              raise ZeroDivisionError
  
@@ -83,7 +94,7 @@
          if coeff:
              if (r.cf.type == n_unknown) or r.cf.cfDivBy(p_GetCoeff(f._poly, r), p_GetCoeff(g._poly, r), r.cf):
                  n = r.cf.cfDiv( p_GetCoeff(f._poly, r) , p_GetCoeff(g._poly, r), r.cf)
-@@ -1194,7 +1194,7 @@ cdef class NCPolynomialRing_plural(Ring):
+@@ -1193,7 +1193,7 @@ cdef class NCPolynomialRing_plural(Ring):
              if isinstance(g, NCPolynomial_plural) \
                     and (<NCPolynomial_plural>g) \
                     and p_LmDivisibleBy((<NCPolynomial_plural>g)._poly, m, r):
@@ -92,11 +103,25 @@
                  #p_SetCoeff(flt, n_Div( p_GetCoeff(f._poly, r) , p_GetCoeff((<NCPolynomial_plural>g)._poly, r), r), r)
                  p_SetCoeff(flt, n_Init(1, r), r)
                  return new_NCP(self,flt), g
+-- 
+cgit v1.0-1-gd88e
+
+
+From d5fc2a4bc640856507d743c2f67ad454874700e7 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Sat, 7 Jul 2018 00:38:56 +0200
+Subject: Don't call singclap_pdivide for integer coefficients, it's no longer
+ supported
+
+---
+ src/sage/rings/polynomial/multi_polynomial_libsingular.pyx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
-index 809ca72c76..9610ce125d 100644
+index f2a11a8..774fecd 100644
 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
 +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
-@@ -4881,7 +4881,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+@@ -4888,7 +4888,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
          if right.is_zero():
              raise ZeroDivisionError
  
@@ -105,4 +130,773 @@
              py_quo = self//right
              py_rem = self - right*py_quo
              return py_quo, py_rem
+-- 
+cgit v1.0-1-gd88e
 
+
+From 4763da19a9ea0be849ee3640fc39747d725cb5a1 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Sat, 21 Jul 2018 11:31:02 +0200
+Subject: Fix lcm of polynomials with integer coefficients and add test
+
+---
+ src/sage/rings/polynomial/multi_polynomial_libsingular.pyx | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index 774fecd..bb5aca6 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -4794,6 +4794,8 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             sage: p = -x*y + x*z + 54*x - 2
+             sage: (5*p^2).lcm(3*p) == 15*p^2
+             True
++            sage: lcm(2*x,2*x*y)
++            2*x*y
+         """
+         cdef ring *_ring = self._parent_ring
+         cdef poly *ret
+@@ -4805,6 +4807,12 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         if _ring.cf.type != n_unknown:
+             if _ring.cf.type == n_Znm or _ring.cf.type == n_Zn or _ring.cf.type == n_Z2m :
+                 raise TypeError("LCM over non-integral domains not available.")
++            if _ring.cf.type == n_Z:
++                f_content = self.content()
++                g_content = g.content()
++                f_primitivepart = self / f_content
++                g_primitivepart = g / g_content
++                return f_primitivepart.change_ring(RationalField()).lcm(g_primitivepart.change_ring(RationalField())) * f_content.lcm(g_content)
+ 
+         if self._parent is not g._parent:
+             _g = self._parent._coerce_c(g)
+-- 
+cgit v1.0-1-gd88e
+
+
+From 544f67d45ce00142d99cbca7ca1ef39df95d3551 Mon Sep 17 00:00:00 2001
+From: Timo Kaufmann <timokau at zoho.com>
+Date: Fri, 20 Jul 2018 16:58:48 +0200
+Subject: =?UTF-8?q?Revert=20"Trac=20#25313:=20Speed=20up=20exact=20divisio?=
+ =?UTF-8?q?n=20in=20=E2=84=A4[x,y,...]"?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This reverts commit 5ef19ad3901910976878348ef2ec76637420010b, reversing
+changes made to 1c41c1d6cadf5bb863d5c0d125300a153f232fa5.
+---
+ .../rings/polynomial/multi_polynomial_libsingular.pyx     | 15 +++++----------
+ 1 file changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index bb5aca6..92d6ed5 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -4023,16 +4023,6 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             Traceback (most recent call last):
+             ...
+             NotImplementedError: Division of multivariate polynomials over non fields by non-monomials not implemented.
+-
+-        TESTS::
+-
+-            sage: P.<x,y> = ZZ[]
+-            sage: p = 3*(-x^8*y^2 - x*y^9 + 6*x^8*y + 17*x^2*y^6 - x^3*y^2)
+-            sage: q = 7*(x^2 + x*y + y^2 + 1)
+-            sage: p*q//q == p
+-            True
+-            sage: p*q//p == q
+-            True
+         """
+         cdef MPolynomialRing_libsingular parent = self._parent
+         cdef ring *r = self._parent_ring
+@@ -4052,6 +4042,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         _right = <MPolynomial_libsingular>right
+ 
+         if r.cf.type != n_unknown:
++            if r.cf.type == n_Z:
++                P = parent.change_ring(RationalField())
++                f = P(self)//P(right)
++                CM = list(f)
++                return parent(sum([c.floor()*m for c,m in CM]))
+             if _right.is_monomial():
+                 p = _self._poly
+                 quo = p_ISet(0,r)
+-- 
+cgit v1.0-1-gd88e
+
+
+From 2cd8487ff5a7f74c6c75659b44be5f48d27639e6 Mon Sep 17 00:00:00 2001
+From: Timo Kaufmann <timokau at zoho.com>
+Date: Fri, 20 Jul 2018 18:32:20 +0200
+Subject: singular: update doctests
+
+---
+ src/sage/rings/polynomial/multi_polynomial_ideal.py        | 1 +
+ src/sage/rings/polynomial/multi_polynomial_libsingular.pyx | 2 +-
+ src/sage/rings/polynomial/polynomial_singular_interface.py | 8 ++++----
+ 3 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+index 37dc45c..8bd5306 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
++++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+@@ -2199,6 +2199,7 @@ class MPolynomialIdeal_singular_repr(
+             sage: I.variety()
+             verbose 0 (...: multi_polynomial_ideal.py, variety) Warning: computations in the complex field are inexact; variety may be computed partially or incorrectly.
+             verbose 0 (...: multi_polynomial_ideal.py, variety) Warning: falling back to very slow toy implementation.
++            ...
+             [{y: -0.86602540378443... - 0.500000000000000*I},
+              {y: -0.86602540378443... + 0.500000000000000*I},
+              {y: 0.86602540378443... - 0.500000000000000*I},
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index 92d6ed5..619e7f0 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -4869,7 +4869,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             sage: f.quo_rem(y)
+             (2*x^2, x + 1)
+             sage: f.quo_rem(3*x)
+-            (2*x*y + 1, -4*x^2*y - 2*x + 1)
++            (0, 2*x^2*y + x + 1)
+ 
+         TESTS::
+ 
+diff --git a/src/sage/rings/polynomial/polynomial_singular_interface.py b/src/sage/rings/polynomial/polynomial_singular_interface.py
+index 9331169..f753610 100644
+--- a/src/sage/rings/polynomial/polynomial_singular_interface.py
++++ b/src/sage/rings/polynomial/polynomial_singular_interface.py
+@@ -81,8 +81,8 @@ class PolynomialRing_singular_repr:
+             sage: R.<x,y> = PolynomialRing(CC)
+             sage: singular(R)
+             polynomial ring, over a field, global ordering
+-            //   coefficients: float[I](complex:15 digits, additional 0 digits)/(I^2+1)
+-            //   number of vars : 2
++            // coefficients: real[I](complex:15 digits, additional 0 digits)/(I^2+1)
++            // number of vars : 2
+             //        block   1 : ordering dp
+             //                  : names    x y
+             //        block   2 : ordering C
+@@ -90,8 +90,8 @@ class PolynomialRing_singular_repr:
+             sage: R.<x,y> = PolynomialRing(RealField(100))
+             sage: singular(R)
+             polynomial ring, over a field, global ordering
+-            //   coefficients: float
+-            //   number of vars : 2
++            // coefficients: Float()
++            // number of vars : 2
+             //        block   1 : ordering dp
+             //                  : names    x y
+             //        block   2 : ordering C
+-- 
+cgit v1.0-1-gd88e
+
+
+From d9dc104b4ff3d3cc34fa8ec9483f83fce033f627 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Sun, 22 Jul 2018 00:54:38 +0200
+Subject: Make Singular error parser more granular
+
+---
+ src/sage/interfaces/singular.py                     | 2 +-
+ src/sage/rings/polynomial/multi_polynomial_ideal.py | 1 -
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9d65c9f..031172e 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -654,7 +654,7 @@ class Singular(ExtraTabCompletion, Expect):
+ 
+         s = Expect.eval(self, x, **kwds)
+ 
+-        if s.find("error") != -1 or s.find("Segment fault") != -1:
++        if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
+             raise SingularError('Singular error:\n%s'%s)
+ 
+         if get_verbose() > 0:
+diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+index 8bd5306..37dc45c 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
++++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+@@ -2199,7 +2199,6 @@ class MPolynomialIdeal_singular_repr(
+             sage: I.variety()
+             verbose 0 (...: multi_polynomial_ideal.py, variety) Warning: computations in the complex field are inexact; variety may be computed partially or incorrectly.
+             verbose 0 (...: multi_polynomial_ideal.py, variety) Warning: falling back to very slow toy implementation.
+-            ...
+             [{y: -0.86602540378443... - 0.500000000000000*I},
+              {y: -0.86602540378443... + 0.500000000000000*I},
+              {y: 0.86602540378443... - 0.500000000000000*I},
+-- 
+cgit v1.0-1-gd88e
+
+
+From ab851b1a2485c98b9f281e5bb5ea294e84f39040 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Sun, 22 Jul 2018 01:02:23 +0200
+Subject: Update some tests output
+
+---
+ src/sage/interfaces/singular.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 031172e..f7972f5 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -1079,7 +1079,7 @@ class Singular(ExtraTabCompletion, Expect):
+             sage: S = singular.ring('real', '(a,b)', 'lp')
+             sage: singular.current_ring()
+             polynomial ring, over a field, global ordering
+-            //   coefficients: float
++            //   coefficients: Float()
+             //   number of vars : 2
+             //        block   1 : ordering lp
+             //                  : names    a b
+@@ -1157,7 +1157,7 @@ class Singular(ExtraTabCompletion, Expect):
+              sage: singular._tab_completion()
+              ['exteriorPower',
+               ...
+-              'flintZ']
++              'crossprod']
+          """
+         p = re.compile("// *([a-z0-9A-Z_]*).*") #compiles regular expression
+         proclist = self.eval("listvar(proc)").splitlines()
+@@ -1183,7 +1183,7 @@ class Singular(ExtraTabCompletion, Expect):
+         EXAMPLES::
+ 
+             sage: singular.version()
+-            "Singular ... version 4.1.0 ...
++            "Singular ... version 4.1.1 ...
+         """
+         return singular_version()
+ 
+@@ -1992,7 +1992,7 @@ class SingularElement(ExtraTabCompletion, ExpectElement):
+             sage: S = singular.ring('real', '(a,b)', 'lp')
+             sage: singular.current_ring()
+             polynomial ring, over a field, global ordering
+-            //   coefficients: float
++            //   coefficients: Float()
+             //   number of vars : 2
+             //        block   1 : ordering lp
+             //                  : names    a b
+@@ -2072,7 +2072,7 @@ class SingularElement(ExtraTabCompletion, ExpectElement):
+             sage: R._tab_completion()
+             ['exteriorPower',
+              ...
+-             'flintZ']
++             'crossprod']
+         """
+         return self.parent()._tab_completion()
+ 
+@@ -2358,7 +2358,7 @@ def singular_version():
+     EXAMPLES::
+ 
+         sage: singular.version()
+-        "Singular ... version 4.1.0 ...
++        "Singular ... version 4.1.1 ...
+     """
+     return singular.eval('system("--version");')
+ 
+-- 
+cgit v1.0-1-gd88e
+
+
+From 921cc310908e1880884af556dc9452c2b4ba8bc8 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Tue, 24 Jul 2018 18:45:26 +0200
+Subject: Fix real base ring detection
+
+Singular prints it as 'Float()' instead of 'real' now
+---
+ src/sage/interfaces/singular.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index f7972f5..3815951 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -1562,7 +1562,7 @@ class SingularElement(ExtraTabCompletion, ExpectElement):
+         elif charstr[0] in ['0', 'QQ']:
+             from sage.all import QQ
+             br = QQ
+-        elif charstr[0]=='real':
++        elif charstr[0].startswith('Float'):
+             from sage.all import RealField, ceil, log
+             prec = singular.eval('ringlist(basering)[1][2][1]')
+             br = RealField(ceil((ZZ(prec)+1)/log(2,10)))
+-- 
+cgit v1.0-1-gd88e
+
+
+From 0f55b763c775bb0d652b53d50dc26f11e9f472a0 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Tue, 24 Jul 2018 19:16:20 +0200
+Subject: More real -> Float porting
+
+---
+ src/sage/interfaces/singular.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 3815951..0447920 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -1750,7 +1750,7 @@ class SingularElement(ExtraTabCompletion, ExpectElement):
+ 
+         # Singular 4 puts parentheses around floats and sign outside them
+         charstr = self.parent().eval('charstr(basering)').split(',',1)
+-        if charstr[0] in ['real', 'complex']:
++        if charstr[0]=='complex' or charstr[0].startswith('Float'):
+               for i in range(coeff_start, 2 * coeff_start):
+                   singular_poly_list[i] = singular_poly_list[i].replace('(','').replace(')','')
+ 
+-- 
+cgit v1.0-1-gd88e
+
+
+From aea054407a41a517070eb06e8efcd02d6356269f Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Tue, 24 Jul 2018 19:38:55 +0200
+Subject: Don't check for exact Singular version
+
+Should improve testing future Singular upgrades on distributions
+---
+ src/sage/interfaces/singular.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 0447920..a028bbe 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -1183,7 +1183,7 @@ class Singular(ExtraTabCompletion, Expect):
+         EXAMPLES::
+ 
+             sage: singular.version()
+-            "Singular ... version 4.1.1 ...
++            "Singular ... version 4...
+         """
+         return singular_version()
+ 
+@@ -2358,7 +2358,7 @@ def singular_version():
+     EXAMPLES::
+ 
+         sage: singular.version()
+-        "Singular ... version 4.1.1 ...
++        "Singular ... version 4...
+     """
+     return singular.eval('system("--version");')
+ 
+-- 
+cgit v1.0-1-gd88e
+
+
+From 4e52b5e3ca6bbb34666c25decbf9bab3e2b46e82 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Wed, 25 Jul 2018 16:17:38 +0200
+Subject: Use p_Divide for lcm as suggested by upstream
+
+See https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=2768
+---
+ src/sage/libs/singular/decl.pxd                            |  4 ++++
+ src/sage/rings/polynomial/multi_polynomial_libsingular.pyx | 12 ++----------
+ 2 files changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
+index 84476a9..d863740 100644
+--- a/src/sage/libs/singular/decl.pxd
++++ b/src/sage/libs/singular/decl.pxd
+@@ -630,6 +630,10 @@ cdef extern from "singular/Singular/libsingular.h":
+     # return p*q, destroys p and q
+     poly *p_Mult_q(poly *p, poly *q, ring *r)
+ 
++    # polynomial division, ignoring the rest
++    # via singclap_pdivide resp. idLift, destroys p,q
++    poly *p_Divide(poly *p, poly *q, ring *r)
++
+     # divide monomial p by monomial q, p,q const
+ 
+     poly *pMDivide(poly *p,poly *q)
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index 619e7f0..aeff53a 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -190,7 +190,7 @@ from sage.libs.singular.decl cimport (
+     n_IsUnit, n_Invers,
+     p_ISet, rChangeCurrRing, p_Copy, p_Init, p_SetCoeff, p_Setm, p_SetExp, p_Add_q,
+     p_NSet, p_GetCoeff, p_Delete, p_GetExp, pNext, rRingVar, omAlloc0, omStrDup,
+-    omFree, pMDivide, p_SetCoeff0, n_Init, p_DivisibleBy, pLcm, p_LmDivisibleBy,
++    omFree, pMDivide, p_Divide, p_SetCoeff0, n_Init, p_DivisibleBy, pLcm, p_LmDivisibleBy,
+     pMDivide, p_IsConstant, p_ExpVectorEqual, p_String, p_LmInit, n_Copy,
+     p_IsUnit, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
+     p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
+@@ -4802,12 +4802,6 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         if _ring.cf.type != n_unknown:
+             if _ring.cf.type == n_Znm or _ring.cf.type == n_Zn or _ring.cf.type == n_Z2m :
+                 raise TypeError("LCM over non-integral domains not available.")
+-            if _ring.cf.type == n_Z:
+-                f_content = self.content()
+-                g_content = g.content()
+-                f_primitivepart = self / f_content
+-                g_primitivepart = g / g_content
+-                return f_primitivepart.change_ring(RationalField()).lcm(g_primitivepart.change_ring(RationalField())) * f_content.lcm(g_content)
+ 
+         if self._parent is not g._parent:
+             _g = self._parent._coerce_c(g)
+@@ -4824,9 +4818,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         if _ring!=currRing: rChangeCurrRing(_ring)  # singclap_gcd
+         gcd = singclap_gcd(p_Copy(self._poly, _ring), p_Copy(_g._poly, _ring), _ring )
+         prod = pp_Mult_qq(self._poly, _g._poly, _ring)
+-        ret = singclap_pdivide(prod , gcd , _ring)
+-        p_Delete(&prod, _ring)
+-        p_Delete(&gcd, _ring)
++        ret = p_Divide(prod, gcd, _ring)
+         if count >= 20:
+             sig_off()
+         return new_MP(self._parent, ret)
+-- 
+cgit v1.0-1-gd88e
+
+From 930ba2eb1cacaf4e1e43733feb560dd105d531be Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Wed, 25 Jul 2018 22:45:15 +0200
+Subject: Remove duplicate cimport
+
+---
+ src/sage/rings/polynomial/multi_polynomial_libsingular.pyx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index aeff53a..f0a174f 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -190,7 +190,7 @@ from sage.libs.singular.decl cimport (
+     n_IsUnit, n_Invers,
+     p_ISet, rChangeCurrRing, p_Copy, p_Init, p_SetCoeff, p_Setm, p_SetExp, p_Add_q,
+     p_NSet, p_GetCoeff, p_Delete, p_GetExp, pNext, rRingVar, omAlloc0, omStrDup,
+-    omFree, pMDivide, p_Divide, p_SetCoeff0, n_Init, p_DivisibleBy, pLcm, p_LmDivisibleBy,
++    omFree, p_Divide, p_SetCoeff0, n_Init, p_DivisibleBy, pLcm, p_LmDivisibleBy,
+     pMDivide, p_IsConstant, p_ExpVectorEqual, p_String, p_LmInit, n_Copy,
+     p_IsUnit, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
+     p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
+-- 
+cgit v1.0-1-gd88e
+
+From 07ef11b3209f498dc771bf5cb02f1b3ce1264cbb Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas at archlinux.org>
+Date: Thu, 26 Jul 2018 15:25:57 +0200
+Subject: rest -> reminder
+
+---
+ src/sage/libs/singular/decl.pxd | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
+index d863740..7f09aaf 100644
+--- a/src/sage/libs/singular/decl.pxd
++++ b/src/sage/libs/singular/decl.pxd
+@@ -630,7 +630,7 @@ cdef extern from "singular/Singular/libsingular.h":
+     # return p*q, destroys p and q
+     poly *p_Mult_q(poly *p, poly *q, ring *r)
+ 
+-    # polynomial division, ignoring the rest
++    # polynomial division, ignoring the remainder
+     # via singclap_pdivide resp. idLift, destroys p,q
+     poly *p_Divide(poly *p, poly *q, ring *r)
+ 
+-- 
+cgit v1.0-1-gd88e
+
+
+From a9e5aed9215175f8cf49327c790ae153648a2513 Mon Sep 17 00:00:00 2001
+From: Jeroen Demeyer <jdemeyer at cage.ugent.be>
+Date: Sat, 28 Jul 2018 15:09:54 +0200
+Subject: Minor fixes to Singular interface
+
+---
+ src/sage/interfaces/singular.py                    |  4 +-
+ .../polynomial/multi_polynomial_libsingular.pyx    | 79 ++++++++++++----------
+ src/sage/rings/polynomial/plural.pyx               | 19 +++---
+ 3 files changed, 55 insertions(+), 47 deletions(-)
+
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index a028bbe..3d563ff 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -654,6 +654,8 @@ class Singular(ExtraTabCompletion, Expect):
+ 
+         s = Expect.eval(self, x, **kwds)
+ 
++        # "Segment fault" is not a typo:
++        # Singular actually does use that string
+         if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
+             raise SingularError('Singular error:\n%s'%s)
+ 
+@@ -1750,7 +1752,7 @@ class SingularElement(ExtraTabCompletion, ExpectElement):
+ 
+         # Singular 4 puts parentheses around floats and sign outside them
+         charstr = self.parent().eval('charstr(basering)').split(',',1)
+-        if charstr[0]=='complex' or charstr[0].startswith('Float'):
++        if charstr[0].startswith('Float') or charstr[0] == 'complex':
+               for i in range(coeff_start, 2 * coeff_start):
+                   singular_poly_list[i] = singular_poly_list[i].replace('(','').replace(')','')
+ 
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index f0a174f..043696e 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -181,8 +181,8 @@ from cysignals.signals cimport sig_on, sig_off
+ from sage.cpython.string cimport char_to_str, str_to_bytes
+ 
+ # singular types
+-from sage.libs.singular.decl cimport ring, poly, ideal, intvec, number, currRing
+-from sage.libs.singular.decl cimport n_unknown,  n_Zp,  n_Q,   n_R,   n_GF,  n_long_R,  n_algExt,n_transExt,n_long_C,   n_Z,   n_Zn,  n_Znm,  n_Z2m,  n_CF
++from sage.libs.singular.decl cimport (ring, poly, ideal, intvec, number,
++    currRing, n_unknown, n_Z, n_Zn, n_Znm, n_Z2m)
+ 
+ # singular functions
+ from sage.libs.singular.decl cimport (
+@@ -198,7 +198,7 @@ from sage.libs.singular.decl cimport (
+     p_LmIsConstant, pTakeOutComp1, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
+     pLength, kNF, p_Neg, p_Minus_mm_Mult_qq, p_Plus_mm_Mult_qq,
+     pDiff, singclap_resultant, p_Normalize,
+-    prCopyR, prCopyR_NoSort )
++    prCopyR, prCopyR_NoSort)
+ 
+ # singular conversion routines
+ from sage.libs.singular.singular cimport si2sa, sa2si, overflow_check
+@@ -225,7 +225,7 @@ from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
+ # base ring imports
+ from sage.rings.finite_rings.finite_field_prime_modn import FiniteField_prime_modn
+ from sage.rings.rational cimport Rational
+-from sage.rings.rational_field import RationalField
++from sage.rings.rational_field import QQ
+ from sage.rings.complex_field import is_ComplexField
+ from sage.rings.real_mpfr import is_RealField
+ from sage.rings.integer_ring import is_IntegerRing, ZZ
+@@ -1693,7 +1693,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
+         if not g._poly:
+             raise ZeroDivisionError
+ 
+-        if r!=currRing: rChangeCurrRing(r)  # pMDivide
++        if r is not currRing:
++            rChangeCurrRing(r)
+         res = pMDivide(f._poly, g._poly)
+         if coeff:
+             if r.cf.type == n_unknown or r.cf.cfDivBy(p_GetCoeff(f._poly, r), p_GetCoeff(g._poly, r), r.cf):
+@@ -1846,19 +1847,18 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
+         cdef poly *flt
+ 
+         if not m:
+-            return f,f
++            return (f, f)
+ 
+         for g in G:
+-            if isinstance(g, MPolynomial_libsingular) \
+-                   and (<MPolynomial_libsingular>g) \
+-                   and g.parent() is self \
+-                   and p_LmDivisibleBy((<MPolynomial_libsingular>g)._poly, m, r):
+-                if r!=currRing: rChangeCurrRing(r)  # pMDivide
+-                flt = pMDivide(f._poly, (<MPolynomial_libsingular>g)._poly)
+-                #p_SetCoeff(flt, n_Div( p_GetCoeff(f._poly, r) , p_GetCoeff((<MPolynomial_libsingular>g)._poly, r), r), r)
+-                p_SetCoeff(flt, n_Init(1, r), r)
+-                return new_MP(self,flt), g
+-        return self._zero_element,self._zero_element
++            if isinstance(g, MPolynomial_libsingular) and g:
++                h = <MPolynomial_libsingular>g
++                if h._parent is self and p_LmDivisibleBy(h._poly, m, r):
++                    if r is not currRing:
++                        rChangeCurrRing(r)
++                    flt = pMDivide(f._poly, h._poly)
++                    p_SetCoeff(flt, n_Init(1, r), r)
++                    return (new_MP(self, flt), h)
++        return (self._zero_element, self._zero_element)
+ 
+     def monomial_pairwise_prime(self, MPolynomial_libsingular g, MPolynomial_libsingular h):
+         """
+@@ -4023,11 +4023,19 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             Traceback (most recent call last):
+             ...
+             NotImplementedError: Division of multivariate polynomials over non fields by non-monomials not implemented.
++
++        TESTS::
++
++            sage: P.<x,y> = ZZ[]
++            sage: p = 3*(-x^8*y^2 - x*y^9 + 6*x^8*y + 17*x^2*y^6 - x^3*y^2)
++            sage: q = 7*(x^2 + x*y + y^2 + 1)
++            sage: p*q//q == p
++            True
++            sage: p*q//p == q
++            True
+         """
+         cdef MPolynomialRing_libsingular parent = self._parent
+         cdef ring *r = self._parent_ring
+-        if(r != currRing): rChangeCurrRing(r)
+-        cdef MPolynomial_libsingular _self, _right
+         cdef poly *quo
+         cdef poly *temp
+         cdef poly *p
+@@ -4038,19 +4046,19 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         if self._parent._base.is_finite() and self._parent._base.characteristic() > 1<<29:
+             raise NotImplementedError("Division of multivariate polynomials over prime fields with characteristic > 2^29 is not implemented.")
+ 
+-        _self = <MPolynomial_libsingular>self
+         _right = <MPolynomial_libsingular>right
+ 
++        if r is not currRing:
++            rChangeCurrRing(r)
++
+         if r.cf.type != n_unknown:
+             if r.cf.type == n_Z:
+-                P = parent.change_ring(RationalField())
+-                f = P(self)//P(right)
+-                CM = list(f)
+-                return parent(sum([c.floor()*m for c,m in CM]))
++                P = parent.change_ring(QQ)
++                f = (<MPolynomial_libsingular>P(self))._floordiv_(P(right))
++                return parent(sum([c.floor() * m for c, m in f]))
+             if _right.is_monomial():
+-                p = _self._poly
++                p = self._poly
+                 quo = p_ISet(0,r)
+-                if r != currRing: rChangeCurrRing(r)   # pMDivide
+                 while p:
+                     if p_DivisibleBy(_right._poly, p, r):
+                         temp = pMDivide(p, _right._poly)
+@@ -4061,16 +4069,13 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             if r.cf.type == n_Znm or r.cf.type == n_Zn or r.cf.type == n_Z2m :
+                 raise NotImplementedError("Division of multivariate polynomials over non fields by non-monomials not implemented.")
+ 
+-        cdef int count = singular_polynomial_length_bounded(_self._poly,15)
++        count = singular_polynomial_length_bounded(self._poly, 15)
+         if count >= 15:  # note that _right._poly must be of shorter length than self._poly for us to care about this call
+             sig_on()
+-        if r!=currRing: rChangeCurrRing(r)   # singclap_pdivide
+-        quo = singclap_pdivide( _self._poly, _right._poly, r )
++        quo = singclap_pdivide(self._poly, _right._poly, r)
+         if count >= 15:
+             sig_off()
+-        f = new_MP(parent, quo)
+-
+-        return f
++        return new_MP(parent, quo)
+ 
+     def factor(self, proof=True):
+         """
+@@ -4789,7 +4794,9 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             sage: p = -x*y + x*z + 54*x - 2
+             sage: (5*p^2).lcm(3*p) == 15*p^2
+             True
+-            sage: lcm(2*x,2*x*y)
++            sage: lcm(2*x, 2*y)
++            2*x*y
++            sage: lcm(2*x, 2*x*y)
+             2*x*y
+         """
+         cdef ring *_ring = self._parent_ring
+@@ -5222,7 +5229,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         if ambient_ring is not self._parent:
+             raise TypeError("the variable is not in the same ring as self")
+ 
+-        if not ambient_ring.has_coerce_map_from(RationalField()):
++        if not ambient_ring.has_coerce_map_from(QQ):
+             raise TypeError("the ring must contain the rational numbers")
+ 
+         gens = ambient_ring.gens()
+@@ -5325,8 +5332,8 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             raise NotImplementedError("Resultants of multivariate polynomials over prime fields with characteristic > 2^29 is not implemented.")
+ 
+         if is_IntegerRing(self._parent._base):
+-            ret = self.change_ring(RationalField()).resultant(other.change_ring(RationalField()),
+-                                                              variable.change_ring(RationalField()))
++            ret = self.change_ring(QQ).resultant(other.change_ring(QQ),
++                                                 variable.change_ring(QQ))
+             return ret.change_ring(ZZ)
+         elif not self._parent._base.is_field():
+             raise ValueError("Resultants require base fields or integer base ring.")
+@@ -5457,7 +5464,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             sage: f.numerator().parent() is P
+             True
+         """
+-        if self.base_ring() == RationalField():
++        if self.base_ring() is QQ:
+             #This part is for compatibility with the univariate case,
+             #where the numerator of a polynomial over RationalField
+             #is a polynomial over IntegerRing
+diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
+index ad20ebc..6dfcb47 100644
+--- a/src/sage/rings/polynomial/plural.pyx
++++ b/src/sage/rings/polynomial/plural.pyx
+@@ -998,7 +998,7 @@ cdef class NCPolynomialRing_plural(Ring):
+         if not g._poly:
+             raise ZeroDivisionError
+ 
+-        res = pMDivide(f._poly,g._poly)
++        res = pMDivide(f._poly, g._poly)
+         if coeff:
+             if (r.cf.type == n_unknown) or r.cf.cfDivBy(p_GetCoeff(f._poly, r), p_GetCoeff(g._poly, r), r.cf):
+                 n = r.cf.cfDiv( p_GetCoeff(f._poly, r) , p_GetCoeff(g._poly, r), r.cf)
+@@ -1187,17 +1187,16 @@ cdef class NCPolynomialRing_plural(Ring):
+         cdef poly *flt
+ 
+         if not m:
+-            return f,f
++            return (f, f)
+ 
+         for g in G:
+-            if isinstance(g, NCPolynomial_plural) \
+-                   and (<NCPolynomial_plural>g) \
+-                   and p_LmDivisibleBy((<NCPolynomial_plural>g)._poly, m, r):
+-                flt = pMDivide(f._poly, (<NCPolynomial_plural>g)._poly)
+-                #p_SetCoeff(flt, n_Div( p_GetCoeff(f._poly, r) , p_GetCoeff((<NCPolynomial_plural>g)._poly, r), r), r)
+-                p_SetCoeff(flt, n_Init(1, r), r)
+-                return new_NCP(self,flt), g
+-        return self._zero_element,self._zero_element
++            if isinstance(g, NCPolynomial_plural) and g:
++                h = <NCPolynomial_plural>g
++                if p_LmDivisibleBy(h._poly, m, r):
++                    flt = pMDivide(f._poly, h._poly)
++                    p_SetCoeff(flt, n_Init(1, r), r)
++                    return (new_NCP(self,flt), h)
++        return (self._zero_element, self._zero_element)
+ 
+     def monomial_pairwise_prime(self, NCPolynomial_plural g, NCPolynomial_plural h):
+         """
+-- 
+cgit v1.0-1-gd88e
+
+
+From 45ff3719d4f9059a0e85d142cd1e31cb87efa11c Mon Sep 17 00:00:00 2001
+From: Jeroen Demeyer <jdemeyer at cage.ugent.be>
+Date: Wed, 8 Aug 2018 10:31:27 +0200
+Subject: Fix debug build of Singular
+
+---
+ build/pkgs/singular/spkg-install | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/build/pkgs/singular/spkg-install b/build/pkgs/singular/spkg-install
+index 41dcad1..5a4d8de 100644
+--- a/build/pkgs/singular/spkg-install
++++ b/build/pkgs/singular/spkg-install
+@@ -6,16 +6,10 @@ SRC=`pwd`/src
+ cd "$SRC"
+ 
+ if [ "x$SAGE_DEBUG" = "xyes" ]; then
++    # This used to disable omalloc but that is not really supported
++    # by upstream
+     SINGULAR_CONFIGURE="$SINGULAR_CONFIGURE --enable-debug --disable-optimizationflags"
+ 
+-    # --disable-omalloc is broken: linking fails because of missing flags
+-    #SINGULAR_CONFIGURE="$SINGULAR_CONFIGURE --disable-omalloc"
+-
+-    # Replace omalloc by xalloc in places unaffected by --disable-omalloc
+-    # See xalloc/README, altough here we just replace the folder for simplicity
+-    rm -rf "$SRC/omalloc"
+-    mv "$SRC/xalloc" "$SRC/omalloc"
+-
+     CFLAGS="$CFLAGS -O0 -g"
+     CXXFLAGS="$CXXFLAGS -O0 -g"
+ else
+-- 
+cgit v1.0-1-gd88e
+

Modified: sagemath-threejs.patch
===================================================================
--- sagemath-threejs.patch	2018-08-17 21:06:27 UTC (rev 372567)
+++ sagemath-threejs.patch	2018-08-17 22:28:57 UTC (rev 372568)
@@ -1,11 +1,11 @@
 --- a/src/sage/repl/rich_output/display_manager.py
 +++ b/src/sage/repl/rich_output/display_manager.py
-@@ -744,7 +744,7 @@ class DisplayManager(SageObject):
+@@ -746,7 +746,7 @@ class DisplayManager(SageObject):
          """
          if online:
              from sage.misc.package import installed_packages
--            version = installed_packages()['threejs']
-+            version = 'r90'
+-            version = installed_packages()['threejs'].split('.')[0]
++            version = 'r95'
              return """
  <script src="https://cdn.rawgit.com/mrdoob/three.js/{0}/build/three.min.js"></script>
  <script src="https://cdn.rawgit.com/mrdoob/three.js/{0}/examples/js/controls/OrbitControls.js"></script>



More information about the arch-commits mailing list