From 73b46a92bcf0a415d5b4a3b29ca47df0d0544076 Mon Sep 17 00:00:00 2001
From: Matthew LeGendre <legendre1@llnl.gov>
Date: Fri, 21 Oct 2016 11:59:41 -0700
Subject: Fix concretize bug where provider sort couldn't handle version ranges

---
 lib/spack/spack/concretize.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'lib')

diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 9c9e9e10ff..3da5efc9fa 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -95,7 +95,11 @@ class DefaultConcretizer(object):
                                      not b.external and b.external_module):
                 # We're choosing between different providers, so
                 # maintain order from provider sort
-                return candidates.index(a) - candidates.index(b)
+                index_of_a = next(i for i in range(0, len(candidates)) \
+                                  if a.satisfies(candidates[i]))
+                index_of_b = next(i for i in range(0, len(candidates)) \
+                                  if b.satisfies(candidates[i]))
+                return index_of_a - index_of_b
 
             result = cmp_specs(a, b)
             if result != 0:
-- 
cgit v1.2.3-70-g09d2


From 5ff08386af70818e48d81c1d49c0c6e373763c16 Mon Sep 17 00:00:00 2001
From: Matthew LeGendre <legendre1@llnl.gov>
Date: Fri, 21 Oct 2016 13:17:23 -0700
Subject: Remove unnecessary blackslash for flake8

---
 lib/spack/spack/concretize.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'lib')

diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 3da5efc9fa..2351e2bfc9 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -95,9 +95,9 @@ class DefaultConcretizer(object):
                                      not b.external and b.external_module):
                 # We're choosing between different providers, so
                 # maintain order from provider sort
-                index_of_a = next(i for i in range(0, len(candidates)) \
+                index_of_a = next(i for i in range(0, len(candidates))
                                   if a.satisfies(candidates[i]))
-                index_of_b = next(i for i in range(0, len(candidates)) \
+                index_of_b = next(i for i in range(0, len(candidates))
                                   if b.satisfies(candidates[i]))
                 return index_of_a - index_of_b
 
-- 
cgit v1.2.3-70-g09d2