summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/graph-tool
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2016-08-12 17:22:13 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-17 10:35:42 +0100
commita56f14e5fcc3e7db1746be862533a7fe337c8c15 (patch)
treefc15a05f66076dc989cd3575f826ec5d7b497429 /scripts/contrib/graph-tool
parenta1f39e5117001c114f6fe61c2e9c22f85b99b25a (diff)
downloadpoky-a56f14e5fcc3e7db1746be862533a7fe337c8c15.tar.gz
poky-a56f14e5fcc3e7db1746be862533a7fe337c8c15.tar.bz2
poky-a56f14e5fcc3e7db1746be862533a7fe337c8c15.zip
graph-tool: update to new networkx API, be iterative
Update the dot parser to the new networkx API (using pydotplus to parse). Also, switch the path display to output the paths as they are found instead of collecting them into a list, so output appears sooner. (From OE-Core rev: c91898b07465fdd5f3629babb7ff9226454de24e) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/graph-tool')
-rwxr-xr-xscripts/contrib/graph-tool13
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/contrib/graph-tool b/scripts/contrib/graph-tool
index 0275fbd5c0..1df5b8c345 100755
--- a/scripts/contrib/graph-tool
+++ b/scripts/contrib/graph-tool
@@ -30,8 +30,7 @@ def get_path_networkx(dotfile, fromnode, tonode):
print('ERROR: Please install the networkx python module')
sys.exit(1)
- graph = networkx.DiGraph(networkx.read_dot(dotfile))
-
+ graph = networkx.DiGraph(networkx.nx_pydot.read_dot(dotfile))
def node_missing(node):
import difflib
close_matches = difflib.get_close_matches(node, graph.nodes(), cutoff=0.7)
@@ -53,11 +52,11 @@ def find_paths(args, usage):
fromnode = args[1]
tonode = args[2]
- paths = list(get_path_networkx(args[0], fromnode, tonode))
- if paths:
- for path in paths:
- print(" -> ".join(map(str,path)))
- else:
+
+ path = None
+ for path in get_path_networkx(args[0], fromnode, tonode):
+ print(" -> ".join(map(str, path)))
+ if not path:
print("ERROR: no path from %s to %s in graph" % (fromnode, tonode))
sys.exit(1)