aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/package_index.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2013-07-17 11:28:44 -0400
committerJason R. Coombs <jaraco@jaraco.com>2013-07-17 11:28:44 -0400
commit3e72e7f7eacca7db638f7230f93cf696d49c77bf (patch)
tree5e696d38763d9ec86ec7ec583ee974ea886029e1 /setuptools/package_index.py
parentd00b66d5f530da930fdd89cdfdf0ff954f88a141 (diff)
downloadexternal_python_setuptools-3e72e7f7eacca7db638f7230f93cf696d49c77bf.tar.gz
external_python_setuptools-3e72e7f7eacca7db638f7230f93cf696d49c77bf.tar.bz2
external_python_setuptools-3e72e7f7eacca7db638f7230f93cf696d49c77bf.zip
Add compatibility for Python 2.4 when querying the hash name. Fixes #440.9.6
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-xsetuptools/package_index.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 70aabd1b..47f00c00 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -242,8 +242,23 @@ class HashChecker(ContentChecker):
def is_valid(self):
return self.hash.hexdigest() == self.expected
+ def _get_hash_name(self):
+ """
+ Python 2.4 implementation of MD5 doesn't supply a .name attribute
+ so provide that name.
+
+ When Python 2.4 is no longer required, replace invocations of this
+ method with simply 'self.hash.name'.
+ """
+ try:
+ return self.hash.name
+ except AttributeError:
+ if 'md5' in str(type(self.hash)):
+ return 'md5'
+ raise
+
def report(self, reporter, template):
- msg = template % self.hash.name
+ msg = template % self._get_hash_name()
return reporter(msg)