[libgit2-glib] Less verbose coverage progress output



commit 76f9017e1c0f2398f238b1fd2ec887549093eae0
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Wed Jun 25 13:21:45 2014 +0200

    Less verbose coverage progress output

 tools/coverage.py |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/tools/coverage.py b/tools/coverage.py
index c64b8f4..63d7689 100755
--- a/tools/coverage.py
+++ b/tools/coverage.py
@@ -98,9 +98,25 @@ def scan_libgit2_glib(cflags, files, git2dir):
     dname = os.path.dirname(__file__)
     allcalls = {}
 
+    l = 0
+
+    if not os.getenv('SILENT'):
+        sys.stderr.write('\n')
+
+    i = 0
+
     for f in files:
         if not os.getenv('SILENT'):
-            sys.stderr.write('Processing {0}\n'.format(f))
+            name = os.path.basename(f)
+
+            if len(name) > l:
+                l = len(name)
+
+            perc = int((i / len(files)) * 100)
+
+            sys.stderr.write('[{0: >3}%] Processing ... {1}{2}\r'.format(perc, name, ' ' * (l - len(name))))
+
+        i += 1
 
         astf = os.path.join(dname, '.' + os.path.basename(f) + '.cache')
 
@@ -142,6 +158,9 @@ def scan_libgit2_glib(cflags, files, git2dir):
             else:
                 allcalls[k] = list(calls[k])
 
+    if not os.getenv('SILENT'):
+        sys.stderr.write('\r[100%] Processing ... done{0}\n'.format(' ' * (l - 4)))
+
     return allcalls
 
 def scan_libgit2(cflags, git2dir):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]