genpkgmetadata.py

[email protected]
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 genpkgmetadata.py |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 7bb2ff3b9691bc64f46c174f60f51fd8fb8f8421
Author: Colin Walters <[email protected]>
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))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.