[yum-git] Branch 'yum-3_2_X' - 2 commits - output.py yum/misc.py
James Antill
james at linux.duke.edu
Tue Jul 22 19:00:34 UTC 2008
output.py | 14 +++++++-------
yum/misc.py | 20 ++++++++++++++++++--
2 files changed, 25 insertions(+), 9 deletions(-)
New commits:
commit da062f14e9299f15c113e8ff5c9eb80169388af7
Author: James Antill <james at and.org>
Date: Tue Jul 22 15:00:29 2008 -0400
Fix for python-2.4.z, as it has no hashlib
diff --git a/yum/misc.py b/yum/misc.py
index 74bab1e..3224a8e 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -20,7 +20,23 @@ try:
import gpgme
except ImportError:
gpgme = None
-import hashlib
+try:
+ import hashlib
+ _available_checksums = ['md5', 'sha1', 'sha256', 'sha512']
+except ImportError:
+ # Python-2.4.z ... gah!
+ import sha
+ import md5
+ _available_checksums = ['md5', 'sha1']
+ class hashlib:
+
+ @staticmethod
+ def new(algo):
+ if algo == 'md5':
+ return md5.new()
+ if algo == 'sha1':
+ return sha.new()
+ raise ValueError, "Bad checksum type"
from Errors import MiscError
@@ -157,7 +173,7 @@ def checksum(sumtype, file, CHUNK=2**16):
if sumtype == 'sha':
sumtype = 'sha1'
- if sumtype in ['md5', 'sha1', 'sha256', 'sha512']:
+ if sumtype in _available_checksums:
sumalgo = hashlib.new(sumtype)
else:
raise MiscError, 'Error Checksumming file, bad checksum type %s' % sumtype
commit 3c6b9b72b5fcb038cd12a4ec207bc39e8bfe7357
Author: James Antill <james at and.org>
Date: Tue Jul 22 15:00:11 2008 -0400
Change function name from simpleNevraList to Envra, as that's what it outputs
diff --git a/output.py b/output.py
index 04b0491..c55e5d7 100644
--- a/output.py
+++ b/output.py
@@ -253,12 +253,12 @@ class YumOutput:
na = ""
print "%-40.40s %-22.22s %-16.16s" % (na, ver, pkg.repoid)
- def simpleNevraList(self, pkg, ui_overflow=False, indent=''):
- nevra = "%s%s" % (indent, str(pkg))
- if ui_overflow and len(nevra) > 63:
- print "%s %s" % (nevra, "...")
- nevra = ""
- print "%-63.63s %-16.16s" % (nevra, pkg.repoid)
+ def simpleEnvraList(self, pkg, ui_overflow=False, indent=''):
+ envra = "%s%s" % (indent, str(pkg))
+ if ui_overflow and len(envra) > 63:
+ print "%s %s" % (envra, "...")
+ envra = ""
+ print "%-63.63s %-16.16s" % (envra, pkg.repoid)
def fmtKeyValFill(self, key, val):
""" Return a key value pair in the common two column output format. """
@@ -419,7 +419,7 @@ class YumOutput:
print '%s%s' % (indent, item)
continue
for pkg in sorted(pkg_names2pkgs[item]):
- self.simpleNevraList(pkg, ui_overflow=True, indent=indent)
+ self.simpleEnvraList(pkg, ui_overflow=True, indent=indent)
def displayPkgsInGroups(self, group):
mylang = get_my_lang_code()
More information about the Yum-cvs-commits
mailing list