[Python-checkins] distutils2: pep8/pyflakes fixes for distutils2.depgraph

tarek.ziade python-checkins at python.org
Sun Mar 13 19:45:15 CET 2011


http://hg.python.org/distutils2/rev/aa918ce6223c
changeset:   1107:aa918ce6223c
user:        Kelsey Hightower <kelsey.hightower at gmail.com>
date:        Mon Feb 28 21:42:32 2011 -0500
summary:
  pep8/pyflakes fixes for distutils2.depgraph

files:
  distutils2/depgraph.py

diff --git a/distutils2/depgraph.py b/distutils2/depgraph.py
--- a/distutils2/depgraph.py
+++ b/distutils2/depgraph.py
@@ -78,7 +78,7 @@
             if label is not None:
                 dist = '%s [%s]' % (dist, label)
             output.append('    ' * level + '%s' % dist)
-            suboutput = self.repr_node(other, level+1)
+            suboutput = self.repr_node(other, level + 1)
             subs = suboutput.split('\n')
             output.extend(subs[1:])
         return '\n'.join(output)
@@ -133,16 +133,16 @@
     :rtype: an :class:`DependencyGraph` instance
     """
     graph = DependencyGraph()
-    provided = {} # maps names to lists of (version, dist) tuples
-    dists = list(dists) # maybe use generator_tools in future
+    provided = {}  # maps names to lists of (version, dist) tuples
+    dists = list(dists)  # maybe use generator_tools in future
 
     # first, build the graph and find out the provides
     for dist in dists:
         graph.add_distribution(dist)
-        provides = (dist.metadata['Provides-Dist'] + dist.metadata['Provides'] +
+        provides = (dist.metadata['Provides-Dist'] +
+                    dist.metadata['Provides'] +
                     ['%s (%s)' % (dist.name, dist.metadata['Version'])])
 
-
         for p in provides:
             comps = p.strip().rsplit(" ", 1)
             name = comps[0]
@@ -152,7 +152,7 @@
                 if len(version) < 3 or version[0] != '(' or version[-1] != ')':
                     raise DistutilsError('Distribution %s has ill formed' \
                                          'provides field: %s' % (dist.name, p))
-                version = version[1:-1] # trim off parenthesis
+                version = version[1:-1]  # trim off parenthesis
             if not name in provided:
                 provided[name] = []
             provided[name].append((version, dist))
@@ -179,7 +179,7 @@
                         match = predicate.match(version)
                     except IrrationalVersionError:
                         # XXX small compat-mode
-                        if version.split(' ' ) == 1:
+                        if version.split(' ') == 1:
                             match = True
                         else:
                             match = False
@@ -204,8 +204,8 @@
         raise ValueError('The given distribution is not a member of the list')
     graph = generate_graph(dists)
 
-    dep = [dist] # dependent distributions
-    fringe = graph.reverse_list[dist] # list of nodes we should inspect
+    dep = [dist]  # dependent distributions
+    fringe = graph.reverse_list[dist]  # list of nodes we should inspect
 
     while not len(fringe) == 0:
         node = fringe.pop()
@@ -214,9 +214,10 @@
             if not prev in dep:
                 fringe.append(prev)
 
-    dep.pop(0) # remove dist from dep, was there to prevent infinite loops
+    dep.pop(0)  # remove dist from dep, was there to prevent infinite loops
     return dep
 
+
 def main():
     from distutils2._backport.pkgutil import get_distributions
     tempout = StringIO()

-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list