[yum-commits] Branch 'yum-3_2_X' - 2 commits - output.py yum/__init__.py
James Antill
james at osuosl.org
Mon Oct 27 16:44:41 UTC 2008
output.py | 28 ++++++++++++++++------------
yum/__init__.py | 4 ++--
2 files changed, 18 insertions(+), 14 deletions(-)
New commits:
commit 38f64fcf228a3af105d51fe744861c6e9b66095b
Author: James Antill <james at and.org>
Date: Mon Oct 27 12:43:09 2008 -0400
Limit terminal width to 20 chars, do the right thing for serial console
diff --git a/output.py b/output.py
index d7356ce..e7cd66e 100644
--- a/output.py
+++ b/output.py
@@ -40,6 +40,18 @@ from yum.packageSack import packagesNewestByNameArch
from textwrap import fill
+def _term_width():
+ """ Simple terminal width, limit to 20 chars. and make 0 == 80. """
+ if not hasattr(urlgrabber.progress, 'terminal_width_cached'):
+ return 80
+ ret = urlgrabber.progress.terminal_width_cached()
+ if ret == 0:
+ return 80
+ if ret < 20:
+ return 20
+ return ret
+
+
class YumTextMeter(TextMeter):
"""
@@ -63,8 +75,7 @@ class YumTerm:
__enabled = True
if hasattr(urlgrabber.progress, 'terminal_width_cached'):
- columns = property(lambda self:
- urlgrabber.progress.terminal_width_cached())
+ columns = property(lambda self: _term_width())
else:
columns = 80
lines = 24
@@ -1084,8 +1095,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
Yum specific callback class for RPM operations.
"""
- if hasattr(urlgrabber.progress, 'terminal_width_cached'):
- _width = property(lambda x: urlgrabber.progress.terminal_width_cached())
+ _width = property(lambda x: _term_width())
def __init__(self):
RPMBaseCallback.__init__(self)
@@ -1097,10 +1107,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
self.mark = "#"
self.marks = 22
- if hasattr(urlgrabber.progress, 'terminal_width_cached'):
- self.width = self._width
- else:
- self.width = 80
+ self.width = self._width
def event(self, package, action, te_current, te_total, ts_current, ts_total):
# this is where a progress bar would be called
@@ -1193,10 +1200,7 @@ def progressbar(current, total, name=None):
else:
percent = 0
- if hasattr(urlgrabber.progress, 'terminal_width_cached'):
- width = urlgrabber.progress.terminal_width_cached()
- else:
- width = 80
+ width = _term_width()
if name is None and current == total:
name = '-'
commit 0968e129c31d9457e5dca5b3e498a0cf89141065
Author: James Antill <james at and.org>
Date: Mon Oct 27 09:25:07 2008 -0400
combat => compat, typos in comments
diff --git a/yum/__init__.py b/yum/__init__.py
index 7c8c57a..4296f5d 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -709,7 +709,7 @@ class YumBase(depsolve.Depsolve):
skipped = self._skipFromTransaction(po)
for skip in skipped:
skipped_po.add(skip)
- # make sure we get the combat arch packages skip from pkgSack and up too.
+ # make sure we get the compat arch packages skip from pkgSack and up too.
if skip not in removed_from_sack and skip.repoid == 'installed':
_remove_from_sack(skip)
if not toRemove: # Nothing was removed, so we still got a problem
@@ -741,7 +741,7 @@ class YumBase(depsolve.Depsolve):
if rpmUtils.arch.isMultiLibArch():
archs = rpmUtils.arch.getArchList()
n,a,e,v,r = po.pkgtup
- # skip for all combat archs
+ # skip for all compat archs
for a in archs:
pkgtup = (n,a,e,v,r)
if self.tsInfo.exists(pkgtup):
More information about the Yum-commits
mailing list