From dad8dce2d4363d4c80bd85770e4f02ad9e92af7d Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Wed, 22 Sep 2010 21:24:05 +0000 Subject: [PATCH] Merge from genscripts r448: brian.dolbec 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 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py index 670e67c..c8c3f78 100644 --- a/pym/gentoolkit/eclean/output.py +++ b/pym/gentoolkit/eclean/output.py @@ -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() -- 2.26.2