diff options
-rw-r--r-- | distutils2/depgraph.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/distutils2/depgraph.py b/distutils2/depgraph.py index abaefc2..30a2528 100644 --- a/distutils2/depgraph.py +++ b/distutils2/depgraph.py @@ -71,16 +71,18 @@ class DependencyGraph: """ self.missing[distribution].append(requirement) + def _repr_dist(self, dist): + return '%r %s' % (dist.name, dist.version) + def repr_node(self, dist, level=1): """Prints only a subgraph""" output = [] - output.append(str(dist)) - # XXX: this code needs cleanup + output.append(self._repr_dist(dist)) for other, label in self.adjacency_list[dist]: - dist = str(other) + dist = self._repr_dist(other) if label is not None: dist = '%s [%s]' % (dist, label) - output.append(' ' * level + dist) + output.append(' ' * level + str(dist)) suboutput = self.repr_node(other, level + 1) subs = suboutput.split('\n') output.extend(subs[1:]) |