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

Antonio Rojas arojas at archlinux.org
Fri Dec 15 21:39:14 UTC 2017


    Date: Friday, December 15, 2017 @ 21:39:13
  Author: arojas
Revision: 274537

Add some fixes for new scipy, matplotlib and networkx

Added:
  sagemath/trunk/pari-stackwarn.patch
  sagemath/trunk/sagemath-lrs.patch
  sagemath/trunk/sagemath-matplotlib2.patch
  sagemath/trunk/sagemath-scipy-1.0.patch
Modified:
  sagemath/trunk/PKGBUILD
  sagemath/trunk/sagemath-networkx2.patch

----------------------------+
 PKGBUILD                   |   30 +++--
 pari-stackwarn.patch       |   23 +++
 sagemath-lrs.patch         |   22 +++
 sagemath-matplotlib2.patch |  253 +++++++++++++++++++++++++++++++++++++++++++
 sagemath-networkx2.patch   |  174 +++++++++++++++++++++++++++++
 sagemath-scipy-1.0.patch   |   16 ++
 6 files changed, 506 insertions(+), 12 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2017-12-15 18:00:54 UTC (rev 274536)
+++ PKGBUILD	2017-12-15 21:39:13 UTC (rev 274537)
@@ -9,7 +9,7 @@
 pkgbase=sagemath
 pkgname=(sagemath sagemath-jupyter)
 pkgver=8.1
-pkgrel=1
+pkgrel=2
 pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
 arch=(x86_64)
 url="http://www.sagemath.org"
@@ -16,7 +16,7 @@
 license=(GPL)
 depends=(ipython2 ppl palp brial cliquer maxima-ecl gfan sympow nauty python2-rpy2 python2-fpylll python2-psutil python2-cypari2
   python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-future libgap flintqs lcalc lrcalc arb
-  eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox rubiks pari-galdata pari-seadata-small planarity rankwidth
+  eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox rubiks pari-galdata pari-seadata-small planarity rankwidth tachyon
   sage-data-combinatorial_designs sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sage-data-conway_polynomials)
 optdepends=('cython2: to compile cython code' 'python2-pkgconfig: to compile cython code'
   'jmol: 3D plots' 'sage-notebook: Flask notebook interface (deprecated)'
@@ -31,13 +31,14 @@
   'latte-integrale: integral point count in polyhedra' 'polymake: polymake backend for polyhedral computations'
   'meataxe: faster matrix arithmetic over finite fields'
   'sirocco: for computing the fundamental group of the complement of a plane curve'
-  'three.js: alternative 3D plots engine' 'tachyon: alternative 3D plots engine')
+  'three.js: alternative 3D plots engine')
 makedepends=(cython2 boost ratpoints symmetrica python2-jinja coin-or-cbc libhomfly libbraiding sirocco
   mcqd coxeter3 bliss-graphs tdlib python2-pkgconfig meataxe libfes)
 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-ecl-no-sigfpe.patch sagemath-threejs.patch
-        sagemath-detect-igraph.patch sagemath-networkx2.patch sagemath-linbox-1.5.patch sagemath-pynac-0.7.14.patch)
+        r-no-readline.patch fes02.patch sagemath-ecl-no-sigfpe.patch sagemath-threejs.patch pari-stackwarn.patch
+        sagemath-detect-igraph.patch sagemath-networkx2.patch sagemath-linbox-1.5.patch sagemath-pynac-0.7.14.patch
+        sagemath-matplotlib2.patch sagemath-scipy-1.0.patch sagemath-lrs.patch)
 sha256sums=('a42b55c2c8ac244535dc9b87171b7d4dd7e1d498099518ab253354fbe2eaaa7b'
             '6dc9b101310f80381c61c0312a3e5c648771bfe0de2e94ac46fafe7282a3e0ee'
             'c41ae665499c6cd775d40bbe178f8786830b0931ee26bf11ee02f7d83bcc8107'
@@ -49,10 +50,14 @@
             '7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94'
             'c31809f887bf9acc45c5bd9dd30bb93e73601d3efbf3016594c3c1d241731c8a'
             '514135b920a43f999571a15e97b41e14f5bed59f65b19643864dc23555a7b830'
+            'bfd2a20a33ab19a8a8b216a77d07f62e809fe1e1879c4f171ce5dca62fd482e9'
             '28d7789b8d777922ab8871ca43b6afab751428cae875c0343d3962e6a2030b88'
-            '37c5c1e694a2aca06c0f1c7d99622ff81fd2bc6a51e8745762294889fa4673f6'
+            '1024f3a6a9a1a6ae96d9962bb7d1f5842f4a4a5ff5098afad81a60188b7d5160'
             'a52d03e04c9d64bb957a1f8dcdae3280ebb9450a7fd76aaf5ae5de5c6f74774f'
-            '538f7b279d72f4b67edb445d386d267f3f7022c1079031ca7ea06f6ce392c906')
+            '538f7b279d72f4b67edb445d386d267f3f7022c1079031ca7ea06f6ce392c906'
+            'b9ab2bb5f381ea425e8763b81b8b3a108a3951c594fb1f37f7df921e7c77e26d'
+            '17397b8e1843b013ef5d2e083369109f0719651edd8ef0c8493cb49e2bc4324a'
+            'c0f65534a845ba802de6196229159fe67fcc3f72f0cb1ce57d4ae5c9fe10282c')
 
 prepare(){
   cd sage-$pkgver
@@ -77,20 +82,26 @@
    -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 warnings during doctesting (Debian)
+  patch -p1 -i ../pari-stackwarn.patch
+# remove deprecated scipy parameters
+  patch -p1 -i ../sagemath-scipy-1.0.patch
 
 # Upstream patches  
 # fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
   patch -p1 -i ../fes02.patch
-# disable SIGFPE for ecl https://trac.sagemath.org/ticket/22191
-# patch -p1 -i ../sagemath-ecl-no-sigfpe.patch
 # fix build with linbox 1.5 https://trac.sagemath.org/ticket/24214
   patch -p1 -i ../sagemath-linbox-1.5.patch
 # fix build with pynac 0.7.14 https://trac.sagemath.org/ticket/24329
   patch -p1 -i ../sagemath-pynac-0.7.14.patch
+# port away from deprecated and removed functions in matplotlib 2 https://trac.sagemath.org/ticket/23696
+  patch -p1 -i ../sagemath-matplotlib2.patch
 
 # use python2
   sed -e 's|#!/usr/bin/env python|#!/usr/bin/env python2|' -e 's|exec python|exec python2|' -i src/bin/*
@@ -107,7 +118,6 @@
   ./configure --prefix=/usr || true
 
   cd src
-  export SAGE_LOCAL="/usr"
   export SAGE_ROOT="$PWD"
   export SAGE_SRC="$PWD"
 

Added: pari-stackwarn.patch
===================================================================
--- pari-stackwarn.patch	                        (rev 0)
+++ pari-stackwarn.patch	2017-12-15 21:39:13 UTC (rev 274537)
@@ -0,0 +1,23 @@
+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
+@@ -39,6 +39,7 @@
+ 
+ float_regex = re.compile('\s*([+-]?\s*((\d*\.?\d+)|(\d+\.?))([eE][+-]?\d+)?)')
+ optional_regex = re.compile(r'(long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w)*))')
++pari_stack_warning_regex = re.compile(r'\s*\*\*\*.*(Warning: increasing stack size to )\d+\.')
+ find_sage_prompt = re.compile(r"^(\s*)sage: ", re.M)
+ find_sage_continuation = re.compile(r"^(\s*)\.\.\.\.:", re.M)
+ random_marker = re.compile('.*random', re.I)
+@@ -879,6 +880,7 @@
+             'you'
+         """
+         got = self.human_readable_escape_sequences(got)
++        got = pari_stack_warning_regex.sub('', got)
+         if isinstance(want, MarkedOutput):
+             if want.random:
+                 return True

Added: sagemath-lrs.patch
===================================================================
--- sagemath-lrs.patch	                        (rev 0)
+++ sagemath-lrs.patch	2017-12-15 21:39:13 UTC (rev 274537)
@@ -0,0 +1,22 @@
+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"
+

Added: sagemath-matplotlib2.patch
===================================================================
--- sagemath-matplotlib2.patch	                        (rev 0)
+++ sagemath-matplotlib2.patch	2017-12-15 21:39:13 UTC (rev 274537)
@@ -0,0 +1,253 @@
+diff --git a/src/sage/all.py b/src/sage/all.py
+index 300f519..19bc8ec 100644
+--- a/src/sage/all.py
++++ b/src/sage/all.py
+@@ -313,8 +313,6 @@ warnings.filters.remove(('ignore', None, DeprecationWarning, None, 0))
+ # Ignore all deprecations from IPython etc.
+ warnings.filterwarnings('ignore',
+     module='.*(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic)')
+-# Ignore warnings due to matplotlib-1.5 together with numpy-1.13
+-warnings.filterwarnings('ignore', module='matplotlib[.]contour|numpy[.]ma[.]core')
+ # However, be sure to keep OUR deprecation warnings
+ warnings.filterwarnings('default',
+     '[\s\S]*See http://trac.sagemath.org/[0-9]* for details.')
+diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py
+index 98d6224..fbce029 100644
+--- a/src/sage/plot/arrow.py
++++ b/src/sage/plot/arrow.py
+@@ -147,8 +147,8 @@ class CurveArrow(GraphicPrimitive):
+         bpath = Path(self.vertices, self.codes)
+         p = FancyArrowPatch(path=bpath,
+                             lw=width, arrowstyle='%s,head_width=%s,head_length=%s' % (style, head_width, head_length),
+-                            fc=color, ec=color)
+-        p.set_linestyle(get_matplotlib_linestyle(options['linestyle'], return_type='long'))
++                            fc=color, ec=color, 
++                            linestyle=get_matplotlib_linestyle(options['linestyle'], return_type='long'))
+         p.set_zorder(options['zorder'])
+         p.set_label(options['legend_label'])
+         subplot.add_patch(p)
+@@ -336,7 +336,7 @@ class Arrow(GraphicPrimitive):
+         this into account. See :trac:`12836`::
+ 
+             sage: fig = Graphics().matplotlib()
+-            sage: sp = fig.add_subplot(1,1,1)
++            sage: sp = fig.add_subplot(1,1,1, label='axis1')
+             sage: a = arrow((0,0), (1,1))
+             sage: b = arrow((0,0), (1,1), width=20)
+             sage: p1 = a[0]._render_on_subplot(sp)
+@@ -358,7 +358,7 @@ class Arrow(GraphicPrimitive):
+             sage: a.save(filename=filename)
+             sage: with open(filename, 'r') as f:
+             ....:     contents = f.read().replace('\n', ' ')
+-            sage: two_stroke_pattern = r'setdash.*stroke.*stroke.*setdash'
++            sage: two_stroke_pattern = r'setdash.*setdash.*stroke.*stroke.*setdash'
+             sage: import re
+             sage: two_stroke_re = re.compile(two_stroke_pattern)
+             sage: two_stroke_re.search(contents) is None
+@@ -383,8 +383,8 @@ class Arrow(GraphicPrimitive):
+                             lw=width,
+                             arrowstyle='%s,head_width=%s,head_length=%s' % (style, head_width, head_length),
+                             shrinkA=arrowshorten_end, shrinkB=arrowshorten_end,
+-                            fc=color, ec=color)
+-        p.set_linestyle(get_matplotlib_linestyle(options['linestyle'], return_type='long'))
++                            fc=color, ec=color,
++                            linestyle=get_matplotlib_linestyle(options['linestyle'], return_type='long'))
+         p.set_zorder(options['zorder'])
+         p.set_label(options['legend_label'])
+ 
+@@ -437,7 +437,7 @@ class Arrow(GraphicPrimitive):
+                             pe1.draw_path(renderer, gc, tpath, affine, rgbFace)
+ 
+             pe1 = ConditionalStroke(CheckNthSubPath(p, 0), [pe.Stroke()])
+-            pe2 = ConditionalStroke(CheckNthSubPath(p, 1), [pe.Stroke(linestyle="solid")])
++            pe2 = ConditionalStroke(CheckNthSubPath(p, 1), [pe.Stroke(dashes={'dash_offset': 0, 'dash_list': None})])
+             p.set_path_effects([pe1, pe2])
+ 
+         subplot.add_patch(p)
+diff --git a/src/sage/plot/contour_plot.py b/src/sage/plot/contour_plot.py
+index 76077e3..efc1f2b 100644
+--- a/src/sage/plot/contour_plot.py
++++ b/src/sage/plot/contour_plot.py
+@@ -178,12 +178,10 @@ class ContourPlot(GraphicPrimitive):
+         if fill:
+             if contours is None:
+                 CSF = subplot.contourf(self.xy_data_array, cmap=cmap,
+-                                       extent=(x0, x1, y0, y1),
+-                                       label=options['legend_label'])
++                                       extent=(x0, x1, y0, y1))
+             else:
+                 CSF = subplot.contourf(self.xy_data_array, contours, cmap=cmap,
+-                                       extent=(x0, x1, y0, y1), extend='both',
+-                                       label=options['legend_label'])
++                                       extent=(x0, x1, y0, y1), extend='both')
+ 
+         linewidths = options.get('linewidths', None)
+         if isinstance(linewidths, (int, Integer)):
+@@ -200,13 +198,11 @@ class ContourPlot(GraphicPrimitive):
+         if contours is None:
+             CS = subplot.contour(self.xy_data_array, cmap=cmap,
+                                  extent=(x0, x1, y0, y1),
+-                                 linewidths=linewidths, linestyles=linestyles,
+-                                 label=options['legend_label'])
++                                 linewidths=linewidths, linestyles=linestyles)
+         else:
+             CS = subplot.contour(self.xy_data_array, contours, cmap=cmap,
+                                  extent=(x0, x1, y0, y1),
+-                                 linewidths=linewidths, linestyles=linestyles,
+-                                 label=options['legend_label'])
++                                 linewidths=linewidths, linestyles=linestyles)
+         if options.get('labels', False):
+             label_options = options['label_options']
+             label_options['fontsize'] = int(label_options['fontsize'])
+diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
+index aa82eda..03a0f3a 100644
+--- a/src/sage/plot/plot.py
++++ b/src/sage/plot/plot.py
+@@ -478,7 +478,7 @@ We test that ``imshow`` works as well, verifying that
+ 
+ ::
+ 
+-    sage: plt.imshow([[(0,0,0)]])
++    sage: plt.imshow([[(0.0,0.0,0.0)]])
+     <matplotlib.image.AxesImage object at ...>
+     sage: plt.savefig(os.path.join(SAGE_TMP, 'foo.png'))
+ 
+@@ -2908,11 +2908,14 @@ def list_plot(data, plotjoined=False, **kwargs):
+         If ``plotjoined`` is ``False`` then the axis that is in log scale
+         must have all points strictly positive. For instance, the following
+         plot will show no points in the figure since the points in the
+-        horizontal axis starts from `(0,1)`.
++        horizontal axis starts from `(0,1)`. Further, matplotlib will display
++        a user warning.
+ 
+         ::
+ 
+             sage: list_plot(yl, scale='loglog')         # both axes are log
++            doctest:warning
++            ...
+             Graphics object consisting of 1 graphics primitive
+ 
+         Instead this will work. We drop the point `(0,1)`.::
+@@ -3288,12 +3291,15 @@ def list_plot_semilogy(data, plotjoined=False, **kwds):
+ 
+         If ``plotjoined`` is ``False`` then the vertical axis must have all
+         points strictly positive. Otherwise the plot will come up empty.
+-        For instance the following plot contains a point at `(1,0)`.
++        For instance the following plot contains a point at `(1,0)`. Further, 
++        matplotlib will display a user warning.
+ 
+         ::
+ 
+             sage: xl = [2**k for k in range(12)]; yl = range(len(xl))
+             sage: list_plot_semilogy(list(zip(xl,yl))) # plot empty due to (1,0)
++            doctest:warning
++            ...
+             Graphics object consisting of 1 graphics primitive
+ 
+         We remove `(1,0)` to fix this.::
+diff --git a/src/sage/plot/plot3d/list_plot3d.py b/src/sage/plot/plot3d/list_plot3d.py
+index c9f22dd..be87ff2 100644
+--- a/src/sage/plot/plot3d/list_plot3d.py
++++ b/src/sage/plot/plot3d/list_plot3d.py
+@@ -29,21 +29,20 @@ def list_plot3d(v, interpolation_type='default', texture="automatic", point_list
+ 
+     OPTIONAL KEYWORDS:
+ 
+-    - ``interpolation_type`` - 'linear', 'nn' (natural neighbor), 'spline'
++    - ``interpolation_type`` - 'linear', 'clough' (CloughTocher2D), 'spline'
+ 
+       'linear' will perform linear interpolation
+ 
+-      The option 'nn' An interpolation method for multivariate data in a 
+-      Delaunay triangulation. The value for an interpolation point is 
+-      estimated using weighted values of the closest surrounding points in 
+-      the triangulation. These points, the natural neighbors, are the ones 
+-      the interpolation point would connect to if inserted into the 
+-      triangulation.
++      The option 'clough' will interpolate by using a piecewise cubic interpolating
++      Bezier polynomial on each triangle, using a Clough-Tocher scheme.
++      The interpolant is guaranteed to be continuously differentiable.
++      The gradients of the interpolant are chosen so that the curvature of the
++      interpolating surface is approximatively minimized.
+ 
+       The option 'spline' interpolates using a bivariate B-spline.
+ 
+       When v is a matrix the default is to use linear interpolation, when
+-      v is a list of points the default is nearest neighbor.
++      v is a list of points the default is 'clough'.
+ 
+     - ``degree`` - an integer between 1 and 5, controls the degree of spline
+       used for spline interpolation. For data that is highly oscillatory
+@@ -320,18 +319,18 @@ def list_plot3d_tuples(v, interpolation_type, texture, **kwds):
+ 
+     OPTIONAL KEYWORDS:
+ 
+-    - ``interpolation_type`` - 'linear', 'nn' (natural neighbor), 'spline'
++    - ``interpolation_type`` - 'linear', 'clough' (CloughTocher2D), 'spline'
+ 
+       'linear' will perform linear interpolation
+ 
+-      The option 'nn' will interpolate by using natural neighbors. The 
+-      value for an interpolation point is estimated using weighted values 
+-      of the closest surrounding points in the triangulation.
++      The option 'clough' will interpolate by using a piecewise cubic interpolating
++      Bezier polynomial on each triangle, using a Clough-Tocher scheme.
++      The interpolant is guaranteed to be continuously differentiable.
+ 
+       The option 'spline' interpolates using a bivariate B-spline.
+ 
+       When v is a matrix the default is to use linear interpolation, when
+-      v is a list of points the default is nearest neighbor.
++      v is a list of points the default is 'clough'.
+ 
+     - ``degree`` - an integer between 1 and 5, controls the degree of spline
+       used for spline interpolation. For data that is highly oscillatory
+@@ -373,7 +372,7 @@ def list_plot3d_tuples(v, interpolation_type, texture, **kwds):
+         sage: list_plot3d([(1, 2, 3), (0, 1, 3), (2, 1, 4), (1, 0, -2)], texture='yellow', num_points=50)
+         Graphics3d Object
+     """
+-    from matplotlib import tri, delaunay
++    from matplotlib import tri
+     import numpy
+     import scipy
+     from random import random
+@@ -439,19 +438,15 @@ def list_plot3d_tuples(v, interpolation_type, texture, **kwds):
+         G._set_extra_kwds(kwds)
+         return G
+ 
+-    if interpolation_type == 'nn'  or interpolation_type =='default':
++    if interpolation_type == 'clough'  or interpolation_type =='default':
+ 
+-        T=delaunay.Triangulation(x,y)
+-        f=T.nn_interpolator(z)
+-        f.default_value=0.0
+-        j=numpy.complex(0,1)
+-        vals=f[ymin:ymax:j*num_points,xmin:xmax:j*num_points]
++        points=[[x[i],y[i]] for i in range(len(x))]
++        j = numpy.complex(0, 1)
++        f = interpolate.CloughTocher2DInterpolator(points,z)
+         from .parametric_surface import ParametricSurface
+-        def g(x,y):
+-            i=round( (x-xmin)/(xmax-xmin)*(num_points-1) )
+-            j=round( (y-ymin)/(ymax-ymin)*(num_points-1) )
+-            z=vals[int(j),int(i)]
+-            return (x,y,z)
++        def g(x, y):
++            z = f([x, y])
++            return (x, y, z)
+         G = ParametricSurface(g, (list(numpy.r_[xmin:xmax:num_points*j]), list(numpy.r_[ymin:ymax:num_points*j])), texture=texture, **kwds)
+         G._set_extra_kwds(kwds)
+         return G
+diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx
+index 3ce4642..f66cd89 100644
+--- a/src/sage/probability/probability_distribution.pyx
++++ b/src/sage/probability/probability_distribution.pyx
+@@ -118,7 +118,7 @@ cdef class ProbabilityDistribution:
+             sage: P = [0.3, 0.4, 0.3]
+             sage: X = GeneralDiscreteDistribution(P)
+             sage: h, b = X.generate_histogram_data(bins = 10)
+-            sage: h
++            sage: h  # rel tol 1e-08
+             [1.6299999999999999,
+              0.0,
+              0.0,

Modified: sagemath-networkx2.patch
===================================================================
--- sagemath-networkx2.patch	2017-12-15 18:00:54 UTC (rev 274536)
+++ sagemath-networkx2.patch	2017-12-15 21:39:13 UTC (rev 274537)
@@ -1,5 +1,62 @@
+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
+@@ -1158,7 +1156,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
+@@ -1227,7 +1225,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))
+@@ -1416,7 +1414,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 8c29602da6..e7a185d586 100644
+index 003a8d6bcb..986137a9b0 100644
 --- a/src/sage/graphs/digraph.py
 +++ b/src/sage/graphs/digraph.py
 @@ -755,7 +755,7 @@ class DiGraph(GenericGraph):
@@ -11,10 +68,96 @@
          elif format == 'igraph':
              if not data.is_directed():
                  raise ValueError("A *directed* igraph graph was expected. To "+
+@@ -2844,7 +2844,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 ::
+ 
+@@ -2870,9 +2870,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:
+@@ -2895,10 +2893,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/basic.py b/src/sage/graphs/generators/basic.py
+index 8777b95c4b..28ef7e48f2 100644
+--- a/src/sage/graphs/generators/basic.py
++++ b/src/sage/graphs/generators/basic.py
+@@ -437,7 +437,7 @@ def CompleteBipartiteGraph(n1, n2):
+ 
+     Compare the plotting::
+ 
+-        sage: n = networkx.complete_bipartite_graph(11,17)
++        sage: n = networkx.complete_bipartite_graph(11r,17r)
+         sage: spring_med = Graph(n)
+         sage: posdict_med = graphs.CompleteBipartiteGraph(11,17)
+ 
+@@ -469,7 +469,7 @@ def CompleteBipartiteGraph(n1, n2):
+         sage: g = []
+         sage: j = []
+         sage: for i in range(9):
+-        ....:     spr = networkx.complete_bipartite_graph(i+1,4)
++        ....:     spr = networkx.complete_bipartite_graph(int(i+1),4r)
+         ....:     k = Graph(spr)
+         ....:     g.append(k)
+         sage: for i in range(3):
+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 b63135d8e6..5775042976 100644
+index 3550f990ef..490813e619 100644
 --- a/src/sage/graphs/graph.py
 +++ b/src/sage/graphs/graph.py
+@@ -108,7 +108,7 @@ examples are covered here.
+    ::
+ 
+        sage: import networkx
+-       sage: K = networkx.complete_bipartite_graph(12,7)
++       sage: K = networkx.complete_bipartite_graph(12r,7r)
+        sage: G = Graph(K)
+        sage: G.degree()
+        [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 12, 12, 12, 12, 12, 12]
 @@ -1199,7 +1199,7 @@ class Graph(GenericGraph):
              self.allow_loops(loops, check=False)
              self.allow_multiple_edges(multiedges, check=False)
@@ -24,3 +167,30 @@
          elif format == 'igraph':
              if data.is_directed():
                  raise ValueError("An *undirected* igraph graph was expected. "+
+@@ -4600,7 +4600,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)]
+ 
+@@ -6288,7 +6288,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):
+         """
+         Returns a graph constructed with maximal cliques as vertices, and
+         edges between maximal cliques with common members in the original
+@@ -6317,7 +6317,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):

Added: sagemath-scipy-1.0.patch
===================================================================
--- sagemath-scipy-1.0.patch	                        (rev 0)
+++ sagemath-scipy-1.0.patch	2017-12-15 21:39:13 UTC (rev 274537)
@@ -0,0 +1,16 @@
+diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
+index 17b5ebb84b..7ce9055cba 100644
+--- a/src/sage/numerical/optimize.py
++++ b/src/sage/numerical/optimize.py
+@@ -486,9 +486,9 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args)
+                 else:
+                     min = optimize.fmin_tnc(f, x0, approx_grad=True, bounds=cons, messages=0, **args)[0]
+         elif isinstance(cons[0], function_type) or isinstance(cons[0], Expression):
+-            min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
++            min = optimize.fmin_cobyla(f, x0, cons, **args)
+     elif isinstance(cons, function_type) or isinstance(cons, Expression):
+-        min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
++        min = optimize.fmin_cobyla(f, x0, cons, **args)
+     return vector(RDF, min)
+ 
+ 



More information about the arch-commits mailing list