From 49bb07201f929b462ebeecfc6e030ebd19865028 Mon Sep 17 00:00:00 2001 From: Sylvain Th?nault Date: Fri, 20 Dec 2013 13:57:31 +0100 Subject: [graph] sort dot node/edge attribute for predictabilities. Closes #202314 --- ChangeLog | 14 +++++++++----- graph.py | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48b6c8c..3fda9e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,20 @@ ChangeLog for logilab.common ============================ +-- + * graph: ensure output is orderd on node and graph ids (#202314) + + 2013-16-12 -- 0.60.1 * modutils: - * don't propagate IOError when package's __init__.py file doesn't - exist (#174606) + * don't propagate IOError when package's __init__.py file doesn't + exist (#174606) - * ensure file is closed, may cause pb depending on the interpreter, eg + * ensure file is closed, may cause pb depending on the interpreter, eg pypy) (#180876) - - * fix support for `extend_path` based nested namespace packages ; + + * fix support for `extend_path` based nested namespace packages ; Report and patch by John Johnson (#177651) * fix some cases of failing python3 install on windows platform / cross diff --git a/graph.py b/graph.py index 94a71b6..d62e8c0 100644 --- a/graph.py +++ b/graph.py @@ -134,14 +134,14 @@ class DotBackend: """ attrs = ['%s="%s"' % (prop, value) for prop, value in props.items()] n_from, n_to = normalize_node_id(name1), normalize_node_id(name2) - self.emit('%s -> %s [%s];' % (n_from, n_to, ", ".join(attrs)) ) + self.emit('%s -> %s [%s];' % (n_from, n_to, ', '.join(sorted(attrs))) ) def emit_node(self, name, **props): """emit a node with given properties. node properties: see http://www.graphviz.org/doc/info/attrs.html """ attrs = ['%s="%s"' % (prop, value) for prop, value in props.items()] - self.emit('%s [%s];' % (normalize_node_id(name), ", ".join(attrs))) + self.emit('%s [%s];' % (normalize_node_id(name), ', '.join(sorted(attrs)))) def normalize_node_id(nid): """Returns a suitable DOT node id for `nid`.""" -- cgit v1.2.1