Merge pull request #595 from mplegendre/bugfix/issue-573-concretize-compilers

Bugfix/issue 573 concretize compilers
This commit is contained in:
Todd Gamblin 2016-03-21 14:59:15 -07:00
commit 77b94f6030
2 changed files with 9 additions and 2 deletions

View File

@ -241,7 +241,7 @@ def concretize_compiler(self, spec):
return False return False
#Find the another spec that has a compiler, or the root if none do #Find the another spec that has a compiler, or the root if none do
other_spec = find_spec(spec, lambda(x) : x.compiler) other_spec = spec if spec.compiler else find_spec(spec, lambda(x) : x.compiler)
if not other_spec: if not other_spec:
other_spec = spec.root other_spec = spec.root
other_compiler = other_spec.compiler other_compiler = other_spec.compiler
@ -288,7 +288,7 @@ def find_spec(spec, condition):
if condition(spec): if condition(spec):
return spec return spec
return None # Nohting matched the condition. return None # Nothing matched the condition.
def cmp_specs(lhs, rhs): def cmp_specs(lhs, rhs):

View File

@ -309,3 +309,10 @@ def test_find_spec_none(self):
Spec('d')), Spec('d')),
Spec('e')) Spec('e'))
self.assertEqual(None, find_spec(s['b'], lambda s: '+foo' in s)) self.assertEqual(None, find_spec(s['b'], lambda s: '+foo' in s))
def test_compiler_child(self):
s = Spec('mpileaks%clang ^dyninst%gcc')
s.concretize()
self.assertTrue(s['mpileaks'].satisfies('%clang'))
self.assertTrue(s['dyninst'].satisfies('%gcc'))