From 10371684e4072a0d5a5cc19e2dbe9eb1292b4b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20=C3=87a=C4=9Flayan?= Date: Wed, 4 Feb 2009 12:23:36 +0000 Subject: [PATCH] * pisi/cli/listupgrades.py (run): Return if there are no updates, resize the first column of the output. * pisi/cli/listnewest.py (run): No need to double check for 'l' before the assignment of maxlen. --- ChangeLog | 6 ++++++ pisi/cli/listnewest.py | 3 +-- pisi/cli/listupgrades.py | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b933ce72..58b64bdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-04 Ozan Çağlayan + * po/*.po: Update PO messages, fix bugzilla url, + * po/tr.po: Complete missing translations. + * pisi/cli/listupgrades.py (run): Return if there are no updates, resize the first column of the output. + * pisi/cli/listnewest.py (run): No need to double check for 'l' before the assignment of maxlen. + 2009-02-02 Faik Uygur * Add human readable package size info to pisi info output. (#8845) * Speed up finding old packages process. (#9101) diff --git a/pisi/cli/listnewest.py b/pisi/cli/listnewest.py index 29449b12..de9df9ca 100644 --- a/pisi/cli/listnewest.py +++ b/pisi/cli/listnewest.py @@ -79,8 +79,7 @@ packages from all repositories. ctx.ui.info(_("Packages added to %s:") % (repo)) # maxlen is defined dynamically from the longest package name (#9021) - if l: - maxlen = max([len(_p) for _p in l]) + maxlen = max([len(_p) for _p in l]) l.sort() for p in l: diff --git a/pisi/cli/listupgrades.py b/pisi/cli/listupgrades.py index 0cb04b8e..753cd519 100644 --- a/pisi/cli/listupgrades.py +++ b/pisi/cli/listupgrades.py @@ -67,8 +67,13 @@ Lists the packages that will be upgraded. if not upgradable_pkgs: ctx.ui.info(_('No packages to upgrade.')) + return upgradable_pkgs.sort() + + # Resize the first column according to the longest package name + maxlen = max([len(_p) for _p in upgradable_pkgs]) + if self.options.install_info: ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date')) print '========================================================================' @@ -81,4 +86,5 @@ Lists the packages that will be upgraded. elif self.options.install_info: ctx.ui.info('%-15s | %s ' % (package.name, inst_info.one_liner())) else: - ctx.ui.info('%15s - %s ' % (package.name, package.summary)) + package.name = package.name + ' ' * (maxlen - len(package.name)) + ctx.ui.info('%s - %s' % (package.name, unicode(package.summary)))