show an arbitrary counter during build cache processing
authorTimo Savola <tsavola@movial.fi>
Mon, 14 Apr 2008 16:01:44 +0000 (19:01 +0300)
committerTimo Savola <tsavola@movial.fi>
Mon, 14 Apr 2008 16:01:44 +0000 (19:01 +0300)
matrix/build.py

index d2f46e3..e35454f 100644 (file)
@@ -73,8 +73,14 @@ def initial_roots(selected):
 
 def uncached_roots(old_roots):
        roots = set()
+       count = [0]
 
        def add_roots(c):
+               if not config.debug:
+                       count[0] += 1
+                       print '\rChecking cache:', count[0],
+                       sys.stdout.flush()
+
                if cache.contains(c):
                        for child in c.get_rdepends():
                                if child.remove_depend(c):
@@ -84,8 +90,12 @@ def uncached_roots(old_roots):
                else:
                        roots.add(c)
 
-       for c in old_roots:
-               add_roots(c)
+       try:
+               for c in old_roots:
+                       add_roots(c)
+       finally:
+               if not config.debug:
+                       print
 
        return list(roots)