networkx upgrade breaks DIB
Bug #1712693 reported by
German Eichberger
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
diskimage-builder |
Fix Released
|
Low
|
Yolanda Robla |
Bug Description
DIB uses a dependency on networkx (see https:/
Changed in diskimage-builder: | |
importance: | Undecided → Low |
status: | New → Confirmed |
To post a comment you must log in.
Yes, we will be restrained by global requirements on this; pip won't select a "b" release anyway.
But, we don't do anything very funky and so it's just the changes that remove 'node' and iterator changes. For reference, to make sure we weren't totally off-base, the following works with 2.0b1 in unit tests
--- builder/ block_device/ config. py builder/ block_device/ config. py graph(config, default_config, state):
raise BlockDeviceSetu pException(
"Duplicate node name: %s" % (node.name))
logger. debug(" Adding %s : %s", node.name, node) graph(config, default_config, state):
logger. debug(" Edges for %s: f:%s t:%s", name,
edges_ from, edges_to)
raise BlockDeviceSetu pException(
"Edge not defined: %s->%s" % (edge_from, name))
dg. add_edge( edge_from, name)
raise BlockDeviceSetu pException(
"Edge not defined: %s->%s" % (name, edge_to))
dg. add_edge( name, edge_to) graph(config, default_config, state):
--- a/diskimage_
+++ b/diskimage_
@@ -190,7 +190,7 @@ def create_
# ensure node names are unique. networkx by default
# just appends the attribute to the node dict for
# existing nodes, which is not what we want.
- if node.name in dg.node:
+ if node.name in dg.nodes:
@@ -210,12 +210,12 @@ def create_
for edge_from in edges_from:
- if edge_from not in dg.node:
+ if edge_from not in dg.nodes:
for edge_to in edges_to:
- if edge_to not in dg.node:
+ if edge_to not in dg.nodes:
@@ -231,10 +231,9 @@ def create_
# Topological sort (i.e. create a linear array that satisfies sort(dg) order_nodes) ) topological_ sort(dg) )
# dependencies) and return the object list
- call_order_nodes = nx.topological_
- logger.debug("Call order: %s", list(call_
- call_order = [dg.node[n]['obj'] for n in call_order_nodes]
-
+ call_order_nodes = list(nx.
+ logger.debug("Call order: %s", call_order_nodes)
+ call_order = [dg.nodes[n]['obj'] for n in call_order_nodes]
return dg, call_order
---
I don't think it's really possible to support both versions at the same time ATM, as "nodes" has changed from an instance method in 1.x to a iterator in 2.x. If someone wants to keep fiddling and make something that does, I'm open to it. I think inclusion of [1] would mean we don't have to do anything at all, which seems like a good idea too.
[1] https:/ /github. com/networkx/ networkx/ issues/ 2630