[Rpm-metadata] genpkgmetadata.py

skvidal at osuosl.org skvidal at osuosl.org
Fri Apr 16 19:57:37 UTC 2010


 genpkgmetadata.py |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 7bb2ff3b9691bc64f46c174f60f51fd8fb8f8421
Author: Colin Walters <walters at fedoraproject.org>
Date:   Fri Apr 16 15:58:05 2010 -0400

    if we're not a tty, don't use the progress output

diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index 1c6a8b3..5c9f6be 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -190,6 +190,9 @@ def parse_args(args, conf):
 
 class MDCallBack(object):
     """cli callback object for createrepo"""
+    def __init__(self):
+        self.__show_progress = os.isatty(1)
+
     def errorlog(self, thing):
         """error log output"""
         print >> sys.stderr, thing
@@ -200,6 +203,9 @@ class MDCallBack(object):
 
     def progress(self, item, current, total):
         """progress bar"""
+        
+        if not self.__show_progress:
+            return
         beg = "%*d/%d - " % (len(str(total)), current, total)
         left = 80 - len(beg)
         sys.stdout.write("\r%s%-*.*s" % (beg, left, left, item))


More information about the Rpm-metadata mailing list