Fix preferred providers.

This commit is contained in:
Michael Kuhn 2016-07-12 19:54:44 +02:00
parent 069de3f008
commit b7d9b58cc5

View file

@ -41,7 +41,7 @@ def _order_for_package(self, pkgname, component, second_key, test_all=True):
pkglist.append('all')
for pkg in pkglist:
order = self.preferred.get(pkg, {}).get(component, {})
if type(order) is dict:
if isinstance(order, dict) and second_key:
order = order.get(second_key, {})
if not order:
continue
@ -89,9 +89,9 @@ def _component_compare(self, pkgname, component, a, b, reverse_natural_compare,
# a and b are considered to match entries in the sorting list if they
# satisfy the list component.
def _spec_compare(self, pkgname, component, a, b, reverse_natural_compare, second_key):
if not a or not a.concrete:
if not a or (not a.concrete and not second_key):
return -1
if not b or not b.concrete:
if not b or (not b.concrete and not second_key):
return 1
specs = self._spec_for_pkgname(pkgname, component, second_key)
a_index = None