New upstream version.

Also:
- Drop upstreamed patches: -is, -source-target, -union-find, -cb-iterable,
  -iterable, and -dict-iteration.
- Unbundle fonts from the documentation.
- Reenable the tests.
- Add -test patch.
This commit is contained in:
Jerry James 2019-11-04 14:33:55 -07:00
parent f6852e8613
commit 714341b579
10 changed files with 101 additions and 224 deletions

View File

@ -1,60 +0,0 @@
https://github.com/networkx/networkx/commit/eb3a675c5b2b15e33b0a4a35bcee34d6b81ed94d
Replace cb.iterable with np.iterable (#3458)
`matplotlib.cbook.iterable` is deprecated in matplotlib 3.1
https://matplotlib.org/3.1.0/api/cbook_api.html#matplotlib.cbook.iterable
Fixes https://github.com/networkx/networkx/issues/3466
--- networkx/drawing/nx_pylab.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/drawing/nx_pylab.py 2019-09-11 10:14:12.380878784 -0600
@@ -550,7 +550,6 @@ def draw_networkx_edges(G, pos,
try:
import matplotlib
import matplotlib.pyplot as plt
- import matplotlib.cbook as cb
from matplotlib.colors import colorConverter, Colormap, Normalize
from matplotlib.collections import LineCollection
from matplotlib.patches import FancyArrowPatch
@@ -576,13 +575,13 @@ def draw_networkx_edges(G, pos,
# set edge positions
edge_pos = np.asarray([(pos[e[0]], pos[e[1]]) for e in edgelist])
- if not cb.iterable(width):
+ if not np.iterable(width):
lw = (width,)
else:
lw = width
if not is_string_like(edge_color) \
- and cb.iterable(edge_color) \
+ and np.iterable(edge_color) \
and len(edge_color) == len(edge_pos):
if np.alltrue([is_string_like(c) for c in edge_color]):
# (should check ALL elements)
@@ -591,7 +590,7 @@ def draw_networkx_edges(G, pos,
for c in edge_color])
elif np.alltrue([not is_string_like(c) for c in edge_color]):
# If color specs are given as (rgb) or (rgba) tuples, we're OK
- if np.alltrue([cb.iterable(c) and len(c) in (3, 4)
+ if np.alltrue([np.iterable(c) and len(c) in (3, 4)
for c in edge_color]):
edge_colors = tuple(edge_color)
else:
@@ -673,7 +672,7 @@ def draw_networkx_edges(G, pos,
line_width = None
shrink_source = 0 # space from source to tail
shrink_target = 0 # space from head to target
- if cb.iterable(node_size): # many node sizes
+ if np.iterable(node_size): # many node sizes
src_node, dst_node = edgelist[i][:2]
index_node = nodelist.index(dst_node)
marker_size = node_size[index_node]
@@ -797,7 +796,6 @@ def draw_networkx_labels(G, pos,
"""
try:
import matplotlib.pyplot as plt
- import matplotlib.cbook as cb
except ImportError:
raise ImportError("Matplotlib required for draw()")
except RuntimeError:

View File

@ -1,17 +0,0 @@
https://github.com/networkx/networkx/commit/52e7b5d8732c84512f5423661f234790ce7b1b5f
Fix dict iteration for Py3.8
Python 3.8 tracks if any key names change while iterating.
https://github.com/python/cpython/pull/12596
--- networkx/classes/reportviews.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/classes/reportviews.py 2019-09-11 09:36:56.783002687 -0600
@@ -1025,7 +1025,7 @@ class EdgeView(OutEdgeView):
def __iter__(self):
seen = {}
for n, nbrs in self._nodes_nbrs():
- for nbr in nbrs:
+ for nbr in list(nbrs):
if nbr not in seen:
yield (n, nbr)
seen[n] = 1

View File

@ -1,22 +0,0 @@
--- networkx/convert_matrix.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/convert_matrix.py 2019-09-11 09:40:18.967671622 -0600
@@ -560,7 +560,7 @@ def from_numpy_matrix(A, parallel_edges=
edges = map(lambda e: (int(e[0]), int(e[1])),
zip(*(np.asarray(A).nonzero())))
# handle numpy constructed data type
- if python_type is 'void':
+ if python_type == 'void':
# Sort the fields by their offset, then by dtype, then by name.
fields = sorted((offset, dtype, name) for name, (dtype, offset) in
A.dtype.fields.items())
--- networkx/drawing/nx_pydot.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/drawing/nx_pydot.py 2019-09-11 09:40:50.592150597 -0600
@@ -199,7 +199,7 @@ def to_pydot(N):
name = N.name
graph_defaults = N.graph.get('graph', {})
- if name is '':
+ if name == '':
P = pydot.Dot('', graph_type=graph_type, strict=strict,
**graph_defaults)
else:

View File

@ -1,27 +0,0 @@
https://github.com/networkx/networkx/commit/d27930ce099d6f0edca8d5d91d5f3a8d9dc90c9d
Fix deprecation warning with Python 3.7 (#3487)
Replace collections.Iterable with collections.abc.Iterable to fix deprecation warning with Python 3.7:
"DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working"
--- networkx/drawing/nx_pylab.py.orig 2019-09-11 10:14:12.380878784 -0600
+++ networkx/drawing/nx_pylab.py 2019-09-11 10:14:26.196649773 -0600
@@ -373,7 +373,7 @@ def draw_networkx_nodes(G, pos,
draw_networkx_labels()
draw_networkx_edge_labels()
"""
- import collections
+ from collections.abc import Iterable
try:
import matplotlib.pyplot as plt
import numpy as np
@@ -399,7 +399,7 @@ def draw_networkx_nodes(G, pos,
except ValueError:
raise nx.NetworkXError('Bad value in node positions.')
- if isinstance(alpha, collections.Iterable):
+ if isinstance(alpha, Iterable):
node_color = apply_alpha(node_color, alpha, nodelist, cmap, vmin, vmax)
alpha = None

View File

@ -1,34 +0,0 @@
https://github.com/networkx/networkx/commit/ea2c8db07e0047daa649d484c4cf68ec2d9035f7
typo: swap source and target
--- networkx/algorithms/shortest_paths/astar.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/algorithms/shortest_paths/astar.py 2019-09-11 09:22:19.922448001 -0600
@@ -131,7 +131,7 @@ def astar_path(G, source, target, heuris
enqueued[neighbor] = ncost, h
push(queue, (ncost + h, next(c), neighbor, ncost, curnode))
- raise nx.NetworkXNoPath("Node %s not reachable from %s" % (source, target))
+ raise nx.NetworkXNoPath("Node %s not reachable from %s" % (target, source))
def astar_path_length(G, source, target, heuristic=None, weight='weight'):
--- networkx/algorithms/shortest_paths/weighted.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/algorithms/shortest_paths/weighted.py 2019-09-11 09:22:46.694007187 -0600
@@ -1422,7 +1422,7 @@ def bellman_ford_path_length(G, source,
return length[target]
except KeyError:
raise nx.NetworkXNoPath(
- "node %s not reachable from %s" % (source, target))
+ "node %s not reachable from %s" % (target, source))
def single_source_bellman_ford_path(G, source, weight='weight'):
@@ -1597,7 +1597,7 @@ def single_source_bellman_ford(G, source
try:
return (dist[target], paths[target])
except KeyError:
- msg = "Node %s not reachable from %s" % (source, target)
+ msg = "Node %s not reachable from %s" % (target, source)
raise nx.NetworkXNoPath(msg)

View File

@ -0,0 +1,42 @@
--- networkx/readwrite/tests/test_gexf.py.orig 2019-10-16 20:03:56.000000000 -0600
+++ networkx/readwrite/tests/test_gexf.py 2019-10-30 11:31:05.799922383 -0600
@@ -409,17 +409,17 @@ gexf.net/1.2draft http://www.gexf.net/1.
nx.set_node_attributes(G, {n: n for n in numpy.arange(4)}, 'number')
G[0][1]['edge-number'] = numpy.float64(1.1)
- expected = """<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft"\
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation\
-="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd">
+ expected = """<gexf xmlns="http://www.gexf.net/1.2draft" xmlns:xsi="\
+http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="\
+http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd" version="1.2">
<meta lastmodifieddate="{}">
<creator>NetworkX {}</creator>
</meta>
<graph defaultedgetype="undirected" mode="static" name="">
- <attributes class="edge" mode="static">
+ <attributes mode="static" class="edge">
<attribute id="1" title="edge-number" type="float" />
</attributes>
- <attributes class="node" mode="static">
+ <attributes mode="static" class="node">
<attribute id="0" title="number" type="int" />
</attributes>
<nodes>
@@ -445,13 +445,13 @@ gexf.net/1.2draft http://www.gexf.net/1.
</node>
</nodes>
<edges>
- <edge id="0" source="0" target="1">
+ <edge source="0" target="1" id="0">
<attvalues>
<attvalue for="1" value="1.1" />
</attvalues>
</edge>
- <edge id="1" source="1" target="2" />
- <edge id="2" source="2" target="3" />
+ <edge source="1" target="2" id="1" />
+ <edge source="2" target="3" id="2" />
</edges>
</graph>
</gexf>""".format(time.strftime('%Y-%m-%d'), nx.__version__)

View File

@ -1,33 +0,0 @@
https://github.com/networkx/networkx/commit/1203164760f7be90d5c3a50ab7ab99f04453af8f
Fix UnionFind set extraction (#3224)
Paths are not guaranteed to be fully pruned by the current
implementation if subtrees are unioned, e.g.:
> uf = UnionFind()
> uf.union(1, 2)
> uf.union(3, 4)
> uf.union(4, 5)
> uf.union(1, 5)
In the current implementation, parents[1]=3 and parents[2]=1.
Thus, the mere call of networkx.utils.groups(parents) will yield a
wrong result:
[set([2]), set([1, 3, 4, 5])]
This patch fixes this behavior by simply doing a "find" operation
(which, in turn, does full path pruning) on every key before calling
groups.
--- networkx/utils/union_find.py.orig 2019-04-11 14:52:34.000000000 -0600
+++ networkx/utils/union_find.py 2019-09-11 09:27:32.240303742 -0600
@@ -90,6 +90,10 @@ class UnionFind:
[['x', 'y'], ['z']]
"""
+ # Ensure fully pruned paths
+ for x in self.parents.keys():
+ _ = self[x] # Evaluated for side-effect only
+
# TODO In Python 3.3+, this should be `yield from ...`.
for block in groups(self.parents).values():
yield block

11
python-networkx.rpmlintrc Normal file
View File

@ -0,0 +1,11 @@
# THIS FILE IS FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON
# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors
# Zip files are not text
addFilter(r'W: file-not-utf8 .*.zip')
# Dangling font symlinks: the Requires ensures they will not dangle
addFilter(r'W: dangling-symlink .*fonts')
# We use the versions of jquery and js-underscore that sphinx gives us
addFilter(r'W: unversioned-explicit-provides bundled\((jquery|js-underscore)\)')

View File

@ -1,8 +1,8 @@
%global srcname networkx
Name: python-%{srcname}
Version: 2.3
Release: 5%{?dist}
Version: 2.4
Release: 1%{?dist}
Summary: Creates and Manipulates Graphs and Networks
License: BSD
URL: http://networkx.github.io/
@ -11,40 +11,27 @@ Source0: https://github.com/networkx/networkx/archive/%{srcname}-%{versio
# The parallel betweenness example hangs when executed, possibly due to a
# function that cannot be pickled. In any case, skip it.
Patch0: %{name}-doc.patch
# Fix incorrect uses of the 'is' keyword
Patch1: %{name}-is.patch
# Fix swapped source and target arguments
# https://github.com/networkx/networkx/commit/ea2c8db07e0047daa649d484c4cf68ec2d9035f7
Patch2: %{name}-source-target.patch
# Fix UnionFind set extraction
# https://github.com/networkx/networkx/commit/1203164760f7be90d5c3a50ab7ab99f04453af8f
Patch3: %{name}-union-find.patch
# Replace use of deprecated matplotlib.cbook.iterable with np.iterable
# https://github.com/networkx/networkx/commit/eb3a675c5b2b15e33b0a4a35bcee34d6b81ed94d
Patch4: %{name}-cb-iterable.patch
# Fix the import of Iterable for python 3
# https://github.com/networkx/networkx/commit/d27930ce099d6f0edca8d5d91d5f3a8d9dc90c9d
Patch5: %{name}-iterable.patch
# Fix iterating over a dictionary when the key names may change
# https://github.com/networkx/networkx/commit/52e7b5d8732c84512f5423661f234790ce7b1b5f
Patch6: %{name}-dict-iteration.patch
# Fix a test that fails on python 3.8 due to reordering of XML attributes.
Patch1: %{name}-test.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: pkgconfig(python3)
BuildRequires: python3-docs
BuildRequires: python3-numpy-doc
BuildRequires: python3dist(decorator)
BuildRequires: python3dist(gdal)
BuildRequires: python3dist(lxml)
BuildRequires: python3dist(matplotlib)
BuildRequires: python3dist(nb2plots)
BuildRequires: python3dist(nose)
BuildRequires: python3dist(nose-ignore-docstring)
BuildRequires: python3dist(numpy)
BuildRequires: python3dist(numpydoc)
BuildRequires: python3dist(pandas)
BuildRequires: python3dist(pillow)
BuildRequires: python3dist(pydot)
BuildRequires: python3dist(pygraphviz)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-cov)
BuildRequires: python3dist(pyyaml)
BuildRequires: python3dist(scipy)
BuildRequires: python3dist(setuptools)
@ -105,7 +92,12 @@ study of the structure, dynamics, and functions of complex networks.
%package doc
Summary: Documentation for networkx
Requires: fontawesome-fonts-web
Requires: font(fontawesome)
Requires: font(lato)
Requires: font(robotoslab)
Provides: bundled(jquery)
Provides: bundled(js-underscore)
%description doc
Documentation for networkx
@ -115,18 +107,39 @@ Documentation for networkx
# Do not use env
for f in $(grep -FRl %{_bindir}/env .); do
sed -e 's,%{_bindir}/env python,%{__python3},' \
sed -e 's,%{_bindir}/env python[[:digit:]]*,%{__python3},' \
-e 's,%{_bindir}/env ,%{_bindir},' \
-i.orig $f
touch -r $f.orig $f
rm $f.orig
done
# Use local objects.inv for intersphinx
sed -e "s|'https://docs\.python\.org/2/': None|'https://docs.python.org/': '%{_docdir}/python3-docs/html/objects.inv'|" \
-e "s|\('https://docs\.scipy\.org/doc/numpy/': \)None|\1'%{_docdir}/python3-numpy-doc/objects.inv'|" \
-i doc/conf.py
%build
%py3_build
# Build the documentation
PYTHONPATH=$PWD/build/lib make -C doc html
rst2html --no-datestamp README.rst README.html
# Do not bundle fonts into the documentation
cd doc/build/html/_static/fonts
for suffix in eot svg ttf woff woff2; do
rm fontawesome-webfont.$suffix
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.$suffix .
done
rm {Lato,RobotoSlab}/*.ttf
ln -s %{_datadir}/fonts/lato/Lato-Bold.ttf Lato/lato-bold.ttf
ln -s %{_datadir}/fonts/lato/Lato-BoldItalic.ttf Lato/lato-bolditalic.ttf
ln -s %{_datadir}/fonts/lato/Lato-Italic.ttf Lato/lato-italic.ttf
ln -s %{_datadir}/fonts/lato/Lato-Regular.ttf Lato/lato-regular.ttf
ln -s %{_datadir}/fonts/google-roboto-slab/RobotoSlab-Bold.ttf RobotoSlab/roboto-slab-v7-bold.ttf
ln -s %{_datadir}/fonts/google-roboto-slab/RobotoSlab-Regular.ttf RobotoSlab/roboto-slab-v7-regular.ttf
cd -
%install
%py3_install
@ -146,15 +159,11 @@ done
# The tests have shebangs, so mark them as executable
grep -rlZ '^#!' %{buildroot}%{python3_sitelib}/networkx | xargs -0 chmod a+x
# Temporarily disabled until a bug in graphviz > 2.38 is fixed that causes
# multigraphs to not work. (Adding the same edge with multiple keys yields
# only the initial edge; see bz 1703571). This is slated to be fixed in
# graphviz 2.42. Once that is built for Fedora, we can reenable the tests.
#%%check
#nosetests-3 -v
%check
pytest
%files -n python3-networkx
%doc README.rst installed-docs/*
%doc README.html installed-docs/*
%license LICENSE.txt
%{python3_sitelib}/networkx*
@ -162,6 +171,14 @@ grep -rlZ '^#!' %{buildroot}%{python3_sitelib}/networkx | xargs -0 chmod a+x
%doc doc/build/html/*
%changelog
* Mon Nov 4 2019 Jerry James <loganjerry@gmail.com> - 2.4-1
- New upstream version
- Drop upstreamed patches: -is, -source-target, -union-find, -cb-iterable,
-iterable, and -dict-iteration
- Unbundle fonts from the documentation
- Reenable the tests
- Add -test patch
* Wed Sep 11 2019 Jerry James <loganjerry@gmail.com> - 2.3-5
- Add -doc patch to fix building the gallery of examples
- Add -is patch to reduce noise in sagemath

View File

@ -1 +1 @@
SHA512 (networkx-2.3.tar.gz) = c94de6f4804e8972e79d125c59d1a6c2c4287123146696e33ecea677f4d78dd319c025ad343238bd350fd1df1396b06eb6cffd33e6182ec7037a585c8857dbe8
SHA512 (networkx-2.4.tar.gz) = 2fedc556d068d2b0b1d238f5f2715c928c7999df33c318b720650893a3e536459545769c8b86c97c62ef56a62cc808848bd6897df9f37656810b11990f5d6be0