diff options
Diffstat (limited to 'engine/SCons/compat/_scons_hashlib.py')
-rw-r--r-- | engine/SCons/compat/_scons_hashlib.py | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/engine/SCons/compat/_scons_hashlib.py b/engine/SCons/compat/_scons_hashlib.py index b325e33..1c93787 100644 --- a/engine/SCons/compat/_scons_hashlib.py +++ b/engine/SCons/compat/_scons_hashlib.py @@ -31,18 +31,18 @@ purposes, anyway). In fact, this module will raise an ImportError if the underlying md5 module isn't available. """ -__revision__ = "src/engine/SCons/compat/_scons_hashlib.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/engine/SCons/compat/_scons_hashlib.py 5023 2010/06/14 22:05:46 scons" import md5 -import string +from string import hexdigits -class md5obj: +class md5obj(object): md5_module = md5 def __init__(self, name, string=''): if not name in ('MD5', 'md5'): - raise ValueError, "unsupported hash type" + raise ValueError("unsupported hash type") self.name = 'md5' self.m = self.md5_module.md5() @@ -61,23 +61,8 @@ class md5obj: def update(self, arg): return self.m.update(arg) - if hasattr(md5.md5(), 'hexdigest'): - - def hexdigest(self): - return self.m.hexdigest() - - else: - - # Objects created by the underlying md5 module have no native - # hexdigest() method (*cough* 1.5.2 *cough*), so provide an - # equivalent lifted from elsewhere. - def hexdigest(self): - h = string.hexdigits - r = '' - for c in self.digest(): - i = ord(c) - r = r + h[(i >> 4) & 0xF] + h[i & 0xF] - return r + def hexdigest(self): + return self.m.hexdigest() new = md5obj |