From 46472e47cb55429a53c181be0c8fa4b7ce7fdd70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 8 May 2006 09:22:21 +0000 Subject: [PATCH] * report total size for install and upgrade ops correctly --- pisi/cli/__init__.py | 2 +- pisi/operations.py | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/pisi/cli/__init__.py b/pisi/cli/__init__.py index 5a40ab90..ad0ee0dd 100644 --- a/pisi/cli/__init__.py +++ b/pisi/cli/__init__.py @@ -127,7 +127,7 @@ class CLI(UI): return False def display_progress(self, **ka): - totalsize = '%4.1f %s' % pisi.util.human_readable_size(ka['total_size']) + totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size']) out = '\r%-30.30s (%s)%3d%% %9.2f %s [%s]' % \ (ka['filename'], totalsize, ka['percent'], ka['rate'], ka['symbol'], ka['eta']) diff --git a/pisi/operations.py b/pisi/operations.py index 48b40399..9902f71c 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -285,19 +285,13 @@ def install_pkg_names(A, reinstall = False, bypass_safety = False): G_f = None order = A - ctx.ui.info(_("""The following minimal list of packages will be installed + ctx.ui.info(_("""Following packages will be installed in the respective order to satisfy dependencies: """) + util.strlist(order)) - #this silly try/except block will be removed soon.. - try: - total_size = sum([packagedb.get_package(p).packageSize for p in order]) - except: - total_size = 0 - - if total_size: - total_size, symbol = util.human_readable_size(total_size) - ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol)) + total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order]) + total_size, symbol = util.human_readable_size(total_size) + ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol)) if ctx.get_option('dry_run'): return @@ -400,6 +394,10 @@ def upgrade_pkg_names(A = [], bypass_safety = False): ctx.ui.info(_('The following packages will be upgraded: ') + util.strlist(order)) + total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order]) + total_size, symbol = util.human_readable_size(total_size) + ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol)) + if ctx.get_option('dry_run'): return