summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/depgraph.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-06-08 02:40:13 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-06-08 02:40:13 (GMT)
commit46bdcf7d4b966f733aaeb609b7e15903f8bf6ec4 (patch)
tree05df244af962833f6f69d109edf4cc34153f7135 /Lib/packaging/depgraph.py
parentea888e038b7c5da136ef90191c16cf5ac6de4b14 (diff)
downloadcpython-46bdcf7d4b966f733aaeb609b7e15903f8bf6ec4.zip
cpython-46bdcf7d4b966f733aaeb609b7e15903f8bf6ec4.tar.gz
cpython-46bdcf7d4b966f733aaeb609b7e15903f8bf6ec4.tar.bz2
Packaging: always use repr to display project names.
This helps debugging in case of trailing blanks and such things.
Diffstat (limited to 'Lib/packaging/depgraph.py')
-rw-r--r--Lib/packaging/depgraph.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/packaging/depgraph.py b/Lib/packaging/depgraph.py
index 9f3d6c3..70b7b84 100644
--- a/Lib/packaging/depgraph.py
+++ b/Lib/packaging/depgraph.py
@@ -72,7 +72,7 @@ class DependencyGraph:
self.missing[distribution].append(requirement)
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):
"""Prints only a subgraph"""
@@ -154,8 +154,8 @@ def generate_graph(dists):
if len(comps) == 2:
version = comps[1]
if len(version) < 3 or version[0] != '(' or version[-1] != ')':
- raise PackagingError('Distribution %s has ill formed' \
- 'provides field: %s' % (dist.name, p))
+ raise PackagingError('distribution %r has ill-formed'
+ 'provides field: %r' % (dist.name, p))
version = version[1:-1] # trim off parenthesis
if not name in provided:
provided[name] = []
@@ -204,8 +204,9 @@ def dependent_dists(dists, dist):
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
"""
- if not dist in dists:
- raise ValueError('The given distribution is not a member of the list')
+ if dist not in dists:
+ raise ValueError('given distribution %r is not a member of the list' %
+ dist.name)
graph = generate_graph(dists)
dep = [dist] # dependent distributions
@@ -243,7 +244,7 @@ def main():
for dist, reqs in graph.missing.items():
if len(reqs) > 0:
- print("Warning: Missing dependencies for %s:" % dist.name,
+ print("Warning: Missing dependencies for %r:" % dist.name,
", ".join(reqs))
# XXX replace with argparse
if len(sys.argv) == 1:
@@ -261,7 +262,7 @@ def main():
tempout.seek(0)
tempout = tempout.read()
print(tempout)
- print('Dot file written at "%s"' % filename)
+ print('Dot file written at %r' % filename)
sys.exit(0)
else:
print('Supported option: -d [filename]')