Commits

Christophe Combelles committed 405b269

fixed issue 163 : don't include md5 when comparing two distributions, and scan
index links before external page links.

Comments (0)

Files changed (5)

 
     hashcmp = property(
         lambda self: (
-            getattr(self,'parsed_version',()), self.precedence, self.key,
-            -len(self.location or ''), self.location, self.py_version,
+            getattr(self,'parsed_version',()),
+            self.precedence,
+            self.key,
+            (self.location or '').split('#md5=')[0],
+            self.py_version,
             self.platform
         )
     )

setuptools/package_index.py

             charset = f.headers.get_param('charset') or 'latin-1'
             page = page.decode(charset, "ignore")
         f.close()
-        if url.startswith(self.index_url) and getattr(f,'code',None)!=404:
-            page = self.process_index(url, page)
         for match in HREF.finditer(page):
             link = urlparse.urljoin(base, htmldecode(match.group(1)))
             self.process_url(link)
+        if url.startswith(self.index_url) and getattr(f,'code',None)!=404:
+            page = self.process_index(url, page)
 
     def process_filename(self, fn, nested=False):
         # process filenames or directories

setuptools/tests/test_packageindex.py

 
         # the distribution has been found
         self.assert_('foobar' in pi)
-        # we have two links
-        self.assert_(len(pi['foobar'])==2)
-        # the first link should be from the index
+        # we have only one link, because links are compared without md5
+        self.assert_(len(pi['foobar'])==1)
+        # the link should be from the index
         self.assert_('correct_md5' in pi['foobar'][0].location)
-        # the second link should be the external one
-        self.assert_('bad_md5' in pi['foobar'][1].location)