Package: python3-networkx
Version: 1.11-1
Severity: normal
Tags: patch
Hi,
the latest upstream release of networkx replaced pydot with pydotplus
for the graphviz reader and writer modules. The reason for this change
was missing python3 support in the pydot upstream package. The Debian
pydot package supports python3 though since 1.0.28-1 and since closing
of #739858. The pydotplus package doesn't exist in Debian yet. The good
news though is, that the pydot package in Debian uses the same API as
the pydotplus package as used by networkx. Thus, a simple solution to
fix this problem in Debian and restore dot support can be found in the
attached patch.
Missing dot support in networkx is currently blocking the next upload of
the source package botch.
Thanks!
cheers, josch
--- networkx/drawing/nx_pydot.py 2016-03-29 12:27:16.000000000 +0200
+++ /usr/lib/python3/dist-packages/networkx/drawing/nx_pydot.py 2016-03-29 12:25:53.411839418 +0200
@@ -61,7 +61,10 @@
-----
Use G = nx.Graph(read_dot(path)) to return a Graph instead of a MultiGraph.
"""
- import pydotplus
+ try:
+ import pydotplus
+ except ImportError:
+ import pydot as pydotplus
data = path.read()
P = pydotplus.graph_from_dot_data(data)
return from_pydot(P)
@@ -172,7 +175,10 @@
-----
"""
- import pydotplus
+ try:
+ import pydotplus
+ except ImportError:
+ import pydot as pydotplus
# set Graphviz graph type
if N.is_directed():
graph_type='digraph'
@@ -259,7 +265,10 @@
>>> pos = nx.nx_pydot.pydot_layout(G)
>>> pos = nx.nx_pydot.pydot_layout(G, prog='dot')
"""
- import pydotplus
+ try:
+ import pydotplus
+ except ImportError:
+ import pydot as pydotplus
P=to_pydot(G)
if root is not None :
P.set("root",make_str(root))
@@ -296,4 +305,7 @@
try:
import pydotplus
except ImportError:
- raise SkipTest("pydotplus not available")
+ try:
+ import pydot as pydotplus
+ except ImportError:
+ raise SkipTest("neither pydotplus nor pydot are available")