Commit 46bdcf7d authored by Éric Araujo's avatar Éric Araujo

Packaging: always use repr to display project names.

This helps debugging in case of trailing blanks and such things.
parent ea888e03
...@@ -72,7 +72,7 @@ class DependencyGraph: ...@@ -72,7 +72,7 @@ class DependencyGraph:
self.missing[distribution].append(requirement) self.missing[distribution].append(requirement)
def _repr_dist(self, dist): def _repr_dist(self, dist):
return '%s %s' % (dist.name, dist.metadata['Version']) return '%r %s' % (dist.name, dist.metadata['Version'])
def repr_node(self, dist, level=1): def repr_node(self, dist, level=1):
"""Prints only a subgraph""" """Prints only a subgraph"""
...@@ -154,8 +154,8 @@ def generate_graph(dists): ...@@ -154,8 +154,8 @@ def generate_graph(dists):
if len(comps) == 2: if len(comps) == 2:
version = comps[1] version = comps[1]
if len(version) < 3 or version[0] != '(' or version[-1] != ')': if len(version) < 3 or version[0] != '(' or version[-1] != ')':
raise PackagingError('Distribution %s has ill formed' \ raise PackagingError('distribution %r has ill-formed'
'provides field: %s' % (dist.name, p)) 'provides field: %r' % (dist.name, p))
version = version[1:-1] # trim off parenthesis version = version[1:-1] # trim off parenthesis
if not name in provided: if not name in provided:
provided[name] = [] provided[name] = []
...@@ -204,8 +204,9 @@ def dependent_dists(dists, dist): ...@@ -204,8 +204,9 @@ def dependent_dists(dists, dist):
:param dists: a list of distributions :param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested :param dist: a distribution, member of *dists* for which we are interested
""" """
if not dist in dists: if dist not in dists:
raise ValueError('The given distribution is not a member of the list') raise ValueError('given distribution %r is not a member of the list' %
dist.name)
graph = generate_graph(dists) graph = generate_graph(dists)
dep = [dist] # dependent distributions dep = [dist] # dependent distributions
...@@ -243,7 +244,7 @@ def main(): ...@@ -243,7 +244,7 @@ def main():
for dist, reqs in graph.missing.items(): for dist, reqs in graph.missing.items():
if len(reqs) > 0: if len(reqs) > 0:
print("Warning: Missing dependencies for %s:" % dist.name, print("Warning: Missing dependencies for %r:" % dist.name,
", ".join(reqs)) ", ".join(reqs))
# XXX replace with argparse # XXX replace with argparse
if len(sys.argv) == 1: if len(sys.argv) == 1:
...@@ -261,7 +262,7 @@ def main(): ...@@ -261,7 +262,7 @@ def main():
tempout.seek(0) tempout.seek(0)
tempout = tempout.read() tempout = tempout.read()
print(tempout) print(tempout)
print('Dot file written at "%s"' % filename) print('Dot file written at %r' % filename)
sys.exit(0) sys.exit(0)
else: else:
print('Supported option: -d [filename]') print('Supported option: -d [filename]')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment