summaryrefslogtreecommitdiff
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
commit320fa3f34482dd211c6ee139a2fbd743920767e5 (patch)
treef12e70c654e0656244be9ed898178a822a5d4c6d
parentd7d6fabc9da024e89dc9aff96eb171bca5254bce (diff)
downloadpython-setuptools-bitbucket-0.9.6.tar.gz
Add compatibility for Python 2.4 when querying the hash name. Fixes #440.9.6
-rw-r--r--CHANGES.txt7
-rw-r--r--setuptools.egg-info/entry_points.txt124
-rw-r--r--setuptools.egg-info/requires.txt6
-rwxr-xr-xsetuptools/package_index.py17
-rw-r--r--setuptools/tests/test_packageindex.py16
5 files changed, 103 insertions, 67 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c1af0c5..6e993ada 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,13 @@ CHANGES
=======
-----
+0.9.6
+-----
+
+* Issue #44: Test failure on Python 2.4 when MD5 hash doesn't have a `.name`
+ attribute.
+
+-----
0.9.5
-----
diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt
index 669a59d6..870a6dbe 100644
--- a/setuptools.egg-info/entry_points.txt
+++ b/setuptools.egg-info/entry_points.txt
@@ -1,62 +1,62 @@
-[setuptools.installation]
-eggsecutable = setuptools.command.easy_install:bootstrap
-
-[console_scripts]
-easy_install-3.3 = setuptools.command.easy_install:main
-easy_install = setuptools.command.easy_install:main
-
-[setuptools.file_finders]
-svn_cvs = setuptools.command.sdist:_default_revctrl
-
-[egg_info.writers]
-PKG-INFO = setuptools.command.egg_info:write_pkg_info
-top_level.txt = setuptools.command.egg_info:write_toplevel_names
-entry_points.txt = setuptools.command.egg_info:write_entries
-eager_resources.txt = setuptools.command.egg_info:overwrite_arg
-depends.txt = setuptools.command.egg_info:warn_depends_obsolete
-namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
-requires.txt = setuptools.command.egg_info:write_requirements
-dependency_links.txt = setuptools.command.egg_info:overwrite_arg
-
-[distutils.commands]
-install_egg_info = setuptools.command.install_egg_info:install_egg_info
-egg_info = setuptools.command.egg_info:egg_info
-saveopts = setuptools.command.saveopts:saveopts
-develop = setuptools.command.develop:develop
-test = setuptools.command.test:test
-rotate = setuptools.command.rotate:rotate
-build_py = setuptools.command.build_py:build_py
-register = setuptools.command.register:register
-bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
-easy_install = setuptools.command.easy_install:easy_install
-install = setuptools.command.install:install
-setopt = setuptools.command.setopt:setopt
-build_ext = setuptools.command.build_ext:build_ext
-upload_docs = setuptools.command.upload_docs:upload_docs
-alias = setuptools.command.alias:alias
-bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst
-sdist = setuptools.command.sdist:sdist
-bdist_egg = setuptools.command.bdist_egg:bdist_egg
-install_scripts = setuptools.command.install_scripts:install_scripts
-install_lib = setuptools.command.install_lib:install_lib
-
-[distutils.setup_keywords]
-zip_safe = setuptools.dist:assert_bool
-test_suite = setuptools.dist:check_test_suite
-use_2to3_exclude_fixers = setuptools.dist:assert_string_list
-test_loader = setuptools.dist:check_importable
-entry_points = setuptools.dist:check_entry_points
-tests_require = setuptools.dist:check_requirements
-package_data = setuptools.dist:check_package_data
-eager_resources = setuptools.dist:assert_string_list
-namespace_packages = setuptools.dist:check_nsp
-include_package_data = setuptools.dist:assert_bool
-extras_require = setuptools.dist:check_extras
-dependency_links = setuptools.dist:assert_string_list
-packages = setuptools.dist:check_packages
-convert_2to3_doctests = setuptools.dist:assert_string_list
-use_2to3 = setuptools.dist:assert_bool
-exclude_package_data = setuptools.dist:check_package_data
-use_2to3_fixers = setuptools.dist:assert_string_list
-install_requires = setuptools.dist:check_requirements
-
+[setuptools.installation]
+eggsecutable = setuptools.command.easy_install:bootstrap
+
+[console_scripts]
+easy_install-3.3 = setuptools.command.easy_install:main
+easy_install = setuptools.command.easy_install:main
+
+[setuptools.file_finders]
+svn_cvs = setuptools.command.sdist:_default_revctrl
+
+[egg_info.writers]
+PKG-INFO = setuptools.command.egg_info:write_pkg_info
+top_level.txt = setuptools.command.egg_info:write_toplevel_names
+entry_points.txt = setuptools.command.egg_info:write_entries
+eager_resources.txt = setuptools.command.egg_info:overwrite_arg
+depends.txt = setuptools.command.egg_info:warn_depends_obsolete
+namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
+requires.txt = setuptools.command.egg_info:write_requirements
+dependency_links.txt = setuptools.command.egg_info:overwrite_arg
+
+[distutils.commands]
+install_egg_info = setuptools.command.install_egg_info:install_egg_info
+egg_info = setuptools.command.egg_info:egg_info
+saveopts = setuptools.command.saveopts:saveopts
+develop = setuptools.command.develop:develop
+test = setuptools.command.test:test
+rotate = setuptools.command.rotate:rotate
+build_py = setuptools.command.build_py:build_py
+register = setuptools.command.register:register
+bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
+easy_install = setuptools.command.easy_install:easy_install
+install = setuptools.command.install:install
+setopt = setuptools.command.setopt:setopt
+build_ext = setuptools.command.build_ext:build_ext
+upload_docs = setuptools.command.upload_docs:upload_docs
+alias = setuptools.command.alias:alias
+bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst
+sdist = setuptools.command.sdist:sdist
+bdist_egg = setuptools.command.bdist_egg:bdist_egg
+install_scripts = setuptools.command.install_scripts:install_scripts
+install_lib = setuptools.command.install_lib:install_lib
+
+[distutils.setup_keywords]
+zip_safe = setuptools.dist:assert_bool
+test_suite = setuptools.dist:check_test_suite
+use_2to3_exclude_fixers = setuptools.dist:assert_string_list
+test_loader = setuptools.dist:check_importable
+entry_points = setuptools.dist:check_entry_points
+tests_require = setuptools.dist:check_requirements
+package_data = setuptools.dist:check_package_data
+eager_resources = setuptools.dist:assert_string_list
+namespace_packages = setuptools.dist:check_nsp
+include_package_data = setuptools.dist:assert_bool
+extras_require = setuptools.dist:check_extras
+dependency_links = setuptools.dist:assert_string_list
+packages = setuptools.dist:check_packages
+convert_2to3_doctests = setuptools.dist:assert_string_list
+use_2to3 = setuptools.dist:assert_bool
+exclude_package_data = setuptools.dist:check_package_data
+use_2to3_fixers = setuptools.dist:assert_string_list
+install_requires = setuptools.dist:check_requirements
+
diff --git a/setuptools.egg-info/requires.txt b/setuptools.egg-info/requires.txt
index 256342f0..e4fb4954 100644
--- a/setuptools.egg-info/requires.txt
+++ b/setuptools.egg-info/requires.txt
@@ -1,13 +1,13 @@
+[ssl:sys_platform=='win32' and python_version=='2.4']
+ctypes==1.0.2
+
[ssl:sys_platform=='win32']
wincertstore==0.1
[certs]
certifi==0.0.8
-[ssl:sys_platform=='win32' and python_version=='2.4']
-ctypes==1.0.2
-
[ssl:python_version in '2.4, 2.5']
ssl==1.16 \ No newline at end of file
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)
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 4f2d382c..3791914a 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -147,7 +147,6 @@ class TestContentCheckers(unittest.TestCase):
def test_md5(self):
checker = setuptools.package_index.HashChecker.from_url(
'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478')
- self.assertEqual(checker.hash.name, 'md5')
checker.feed('You should probably not be using MD5'.encode('ascii'))
self.assertEqual(checker.hash.hexdigest(),
'f12895fdffbd45007040d2e44df98478')
@@ -166,3 +165,18 @@ class TestContentCheckers(unittest.TestCase):
'http://foo/bar#md5=')
checker.feed('anything'.encode('ascii'))
self.assertTrue(checker.is_valid())
+
+ def test_get_hash_name_md5(self):
+ checker = setuptools.package_index.HashChecker.from_url(
+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478')
+ if sys.version_info >= (2,5):
+ self.assertEqual(checker.hash.name, 'md5')
+ else:
+ # Python 2.4 compatability
+ self.assertEqual(checker._get_hash_name(), 'md5')
+
+ def test_report(self):
+ checker = setuptools.package_index.HashChecker.from_url(
+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478')
+ rep = checker.report(lambda x: x, 'My message about %s')
+ self.assertEqual(rep, 'My message about md5')