From b7d9b58cc5de8a36d43cc082cac0e1ccb6e05f74 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Tue, 12 Jul 2016 19:54:44 +0200 Subject: Fix preferred providers. --- lib/spack/spack/preferred_packages.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/preferred_packages.py b/lib/spack/spack/preferred_packages.py index 4820584150..e873fa3c7e 100644 --- a/lib/spack/spack/preferred_packages.py +++ b/lib/spack/spack/preferred_packages.py @@ -41,7 +41,7 @@ class PreferredPackages(object): 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 @@ class PreferredPackages(object): # 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 -- cgit v1.2.3-60-g2f50