Commit 0852c453 authored by Jason R. Coombs's avatar Jason R. Coombs

Correct sort order by using list.sort with support for 'key' and 'reverse'....

Correct sort order by using list.sort with support for 'key' and 'reverse'. This method is less efficient, but allows the tests to pass.
parent 3d8a7a97
...@@ -29,7 +29,6 @@ import token ...@@ -29,7 +29,6 @@ import token
import symbol import symbol
import operator import operator
import platform import platform
import bisect
from pkgutil import get_importer from pkgutil import get_importer
try: try:
...@@ -828,7 +827,8 @@ class Environment(object): ...@@ -828,7 +827,8 @@ class Environment(object):
if self.can_add(dist) and dist.has_version(): if self.can_add(dist) and dist.has_version():
dists = self._distmap.setdefault(dist.key, []) dists = self._distmap.setdefault(dist.key, [])
if dist not in dists: if dist not in dists:
bisect.insort(dists, dist) dists.append(dist)
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
def best_match(self, req, working_set, installer=None): def best_match(self, req, working_set, installer=None):
"""Find distribution best matching `req` and usable on `working_set` """Find distribution best matching `req` and usable on `working_set`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment