[Python-checkins] distutils2: distinfo_dirname function is now tested for -'s in the name.

tarek.ziade python-checkins at python.org
Mon Apr 5 23:09:19 CEST 2010


tarek.ziade pushed 3ce9da5cd426 to distutils2:

http://hg.python.org/distutils2/rev/3ce9da5cd426
changeset:   91:3ce9da5cd426
user:        pumazi
date:        Tue Mar 30 21:18:22 2010 -0400
summary:     distinfo_dirname function is now tested for -'s in the name.
files:       src/distutils2/_backport/pkgutil.py, src/distutils2/_backport/tests/test_pkgutil.py

diff --git a/src/distutils2/_backport/pkgutil.py b/src/distutils2/_backport/pkgutil.py
--- a/src/distutils2/_backport/pkgutil.py
+++ b/src/distutils2/_backport/pkgutil.py
@@ -683,6 +683,7 @@
     :returns: directory name
     :rtype: string"""
     file_extension = '.dist-info'
+    name = name.replace('-', '_')
     return '-'.join([name, version]) + file_extension
 
 def get_distributions():
diff --git a/src/distutils2/_backport/tests/test_pkgutil.py b/src/distutils2/_backport/tests/test_pkgutil.py
--- a/src/distutils2/_backport/tests/test_pkgutil.py
+++ b/src/distutils2/_backport/tests/test_pkgutil.py
@@ -29,6 +29,16 @@
         dirname = distinfo_dirname(name, version)
         self.assertEqual(dirname, standard_dirname)
 
+        # Test for another except this time with a '-' in the name, which
+        #   needs to be transformed during the name lookup
+        name = 'python-ldap'
+        version = '2.5'
+        standard_dirname = 'python_ldap-2.5.dist-info'
+
+        from distutils2._backport.pkgutil import distinfo_dirname
+        dirname = distinfo_dirname(name, version)
+        self.assertEqual(dirname, standard_dirname)
+
 
 def test_suite():
     return unittest2.makeSuite(TestPkgUtil)

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list