Merge from genscripts r448: brian.dolbec
authorfuzzyray <fuzzyray@gentoo.org>
Wed, 22 Sep 2010 21:24:05 +0000 (21:24 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Wed, 22 Sep 2010 21:24:05 +0000 (21:24 -0000)
Fix the output of the deprecated pkg information to reflect whether it was able
to save their sources or not.

Merge from genscripts r439: brian.dolbec
fix the prettySize output errors introduced when I removed the deprecated
formatting style previously used.  This now properly displays the rounded file
sizes.

svn path=/trunk/gentoolkit/; revision=807

pym/gentoolkit/eclean/output.py

index 670e67c8458fc413b837078baaca8093fc8bd13c..c8c3f780b6064afe20ecdbbdf86f6f4cb0601c59 100644 (file)
@@ -91,14 +91,18 @@ class OutputControl(object):
                        color = self.numbers
                units = [" G"," M"," K"," B"]
                approx = 0
+               # by using 1000 as the changeover, the integer portion
+               # of the number will never be more than 3 digits long
+               # but the true base 2 value of 1024 is used for the actual
+               # calulation to maintain better accuracy.
                while len(units) and size >= 1000:
                        approx = 1
-                       size = size / 1024.
+                       size = size / 1024.0
                        units.pop()
-               sizestr = '%d'% size + units[-1]
+               sizestr = "%.1f" %(round(size,1)) + units[-1]
                if justify:
                        sizestr = " " + self.brace("[ ")  + \
-                               color(sizestr.rjust(7)) + self.brace(" ]")
+                               color(sizestr.rjust(8)) + self.brace(" ]")
                return sizestr
 
        def yesNoAllPrompt(self, message="Do you want to proceed?"):
@@ -175,5 +179,9 @@ class OutputControl(object):
                """
                indent = ' ' * 12
                for key in pkgs:
-                       print( indent,self.pkg_color(key))
+                       if pkgs[key]:
+                               saved = ""
+                       else:
+                               saved = " ...distfile name(s) not known/saved"
+                       print( indent,self.pkg_color(key) + saved)
                print()