summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2018-07-17 10:36:01 +1000
committerTony Breeds <tony@bakeyournoodle.com>2018-07-18 09:27:01 +1000
commit110732672309e9c4e4d817cc4025314c04e927a0 (patch)
treef9174c807978ab6587a4cda40a99dd0b6e7b6f30
parentb79952af2a3a07a2ab38ed292cb0eef7febe2258 (diff)
Update pylint to 1.7.6, uncap networkxHEAD2.16.0master
This review squashes: Iac9afc7766d3640815dc20cfd6de1245d36a09cc Ie894b5801bd7b3815432882cd626941e89d9f9a1 We need to do this as we can't fix pylint without networkx as that failes requirements-chak due to us having a cap on networkx and we can't uncap networkx as part of tripleo-buildimage installs without constratints which gets us 2.1 and DIB desn't support 2.x This is the commit message Iac9afc7766d3640815dc20cfd6de1245d36a09cc --- One of the pylint dependencies has updated to be python3 only; this version of pylint correctly caps things so it still works with python2. This also exposes that we need to uncap networkx due to I34045f87ca19c2f184b040f4d89347374cce518b. We should remain on version 1 for now thanks to upper-constraints, but we need to maintain the lower-constraint. --- This is the commit message Ie894b5801bd7b3815432882cd626941e89d9f9a1 --- Support different versions of networkx Since the entry of networkx 2.0 nodes has a different behaviour. Checking if dg.nodes is iterable is enough to add compatibility for new/older versions. --- Change-Id: I82dc61fac6c156a4f0d574290c7632077aa53195
Notes
Notes (review): Code-Review+2: Ian Wienand <iwienand@redhat.com> Code-Review+2: Tony Breeds <tony@bakeyournoodle.com> Workflow+1: Tony Breeds <tony@bakeyournoodle.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 18 Jul 2018 04:46:07 +0000 Reviewed-on: https://review.openstack.org/583413 Project: openstack/diskimage-builder Branch: refs/heads/master
-rw-r--r--diskimage_builder/block_device/config.py18
-rw-r--r--requirements.txt2
-rw-r--r--test-requirements.txt2
3 files changed, 14 insertions, 8 deletions
diff --git a/diskimage_builder/block_device/config.py b/diskimage_builder/block_device/config.py
index 29d2f5a..8d71e7d 100644
--- a/diskimage_builder/block_device/config.py
+++ b/diskimage_builder/block_device/config.py
@@ -159,6 +159,12 @@ def create_graph(config, default_config, state):
159 # add the appropriate nodes and edges. 159 # add the appropriate nodes and edges.
160 dg = nx.DiGraph() 160 dg = nx.DiGraph()
161 161
162 # check about dg.nodes, to support different networkx versions
163 if hasattr(dg.nodes, '__iter__'):
164 dg_nodes = dg.nodes
165 else:
166 dg_nodes = dg.node
167
162 for config_entry in config: 168 for config_entry in config:
163 # this should have been checked by generate_config 169 # this should have been checked by generate_config
164 assert len(config_entry) == 1 170 assert len(config_entry) == 1
@@ -190,7 +196,7 @@ def create_graph(config, default_config, state):
190 # ensure node names are unique. networkx by default 196 # ensure node names are unique. networkx by default
191 # just appends the attribute to the node dict for 197 # just appends the attribute to the node dict for
192 # existing nodes, which is not what we want. 198 # existing nodes, which is not what we want.
193 if node.name in dg.node: 199 if node.name in dg_nodes:
194 raise BlockDeviceSetupException( 200 raise BlockDeviceSetupException(
195 "Duplicate node name: %s" % (node.name)) 201 "Duplicate node name: %s" % (node.name))
196 logger.debug("Adding %s : %s", node.name, node) 202 logger.debug("Adding %s : %s", node.name, node)
@@ -210,12 +216,12 @@ def create_graph(config, default_config, state):
210 logger.debug("Edges for %s: f:%s t:%s", name, 216 logger.debug("Edges for %s: f:%s t:%s", name,
211 edges_from, edges_to) 217 edges_from, edges_to)
212 for edge_from in edges_from: 218 for edge_from in edges_from:
213 if edge_from not in dg.node: 219 if edge_from not in dg_nodes:
214 raise BlockDeviceSetupException( 220 raise BlockDeviceSetupException(
215 "Edge not defined: %s->%s" % (edge_from, name)) 221 "Edge not defined: %s->%s" % (edge_from, name))
216 dg.add_edge(edge_from, name) 222 dg.add_edge(edge_from, name)
217 for edge_to in edges_to: 223 for edge_to in edges_to:
218 if edge_to not in dg.node: 224 if edge_to not in dg_nodes:
219 raise BlockDeviceSetupException( 225 raise BlockDeviceSetupException(
220 "Edge not defined: %s->%s" % (name, edge_to)) 226 "Edge not defined: %s->%s" % (name, edge_to))
221 dg.add_edge(name, edge_to) 227 dg.add_edge(name, edge_to)
@@ -231,9 +237,9 @@ def create_graph(config, default_config, state):
231 237
232 # Topological sort (i.e. create a linear array that satisfies 238 # Topological sort (i.e. create a linear array that satisfies
233 # dependencies) and return the object list 239 # dependencies) and return the object list
234 call_order_nodes = nx.topological_sort(dg) 240 call_order_nodes = list(nx.topological_sort(dg))
235 logger.debug("Call order: %s", list(call_order_nodes)) 241 logger.debug("Call order: %s", call_order_nodes)
236 call_order = [dg.node[n]['obj'] for n in call_order_nodes] 242 call_order = [dg_nodes[n]['obj'] for n in call_order_nodes]
237 243
238 return dg, call_order 244 return dg, call_order
239 245
diff --git a/requirements.txt b/requirements.txt
index a40955b..2ece8cf 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
2# of appearance. Changing the order has an impact on the overall integration 2# of appearance. Changing the order has an impact on the overall integration
3# process, which may cause wedges in the gate later. 3# process, which may cause wedges in the gate later.
4Babel!=2.4.0,>=2.3.4 # BSD 4Babel!=2.4.0,>=2.3.4 # BSD
5networkx<2.0,>=1.10 # BSD 5networkx>=1.10 # BSD
6pbr!=2.1.0,>=2.0.0 # Apache-2.0 6pbr!=2.1.0,>=2.0.0 # Apache-2.0
7PyYAML>=3.12 # MIT 7PyYAML>=3.12 # MIT
8flake8<2.6.0,>=2.5.4 # MIT 8flake8<2.6.0,>=2.5.4 # MIT
diff --git a/test-requirements.txt b/test-requirements.txt
index 575906b..6999682 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,7 +2,7 @@
2# of appearance. Changing the order has an impact on the overall integration 2# of appearance. Changing the order has an impact on the overall integration
3# process, which may cause wedges in the gate later. 3# process, which may cause wedges in the gate later.
4hacking<0.11,>=0.10.0 4hacking<0.11,>=0.10.0
5pylint==1.7.1 # GPLv2 5pylint==1.7.6 # GPLv2
6 6
7fixtures>=3.0.0 # Apache-2.0/BSD 7fixtures>=3.0.0 # Apache-2.0/BSD
8mock>=2.0.0 # BSD 8mock>=2.0.0 # BSD