From 788ad561bd975196ef82578eba2a1d76341c3b35 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Thu, 23 Mar 2023 10:27:43 -0700 Subject: [PATCH] fix excludes with bcast --- lib/spack/spack/spec_list.py | 39 ++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/spack/spack/spec_list.py b/lib/spack/spack/spec_list.py index c5f1de0667c..4b9d086ff59 100644 --- a/lib/spack/spack/spec_list.py +++ b/lib/spack/spack/spec_list.py @@ -199,28 +199,33 @@ def _expand_matrix_constraints(matrix_config): flat_combo = [constraint for constraint_list in combo for constraint in constraint_list] flat_combo = [Spec(x) for x in flat_combo] - test_spec = flat_combo[0].copy() - for constraint in flat_combo[1:]: - test_spec.constrain(constraint) - - # Abstract variants don't have normal satisfaction semantics - # Convert all variants to concrete types. - # This method is best effort, so all existing variants will be - # converted before any error is raised. - # Catch exceptions because we want to be able to operate on - # abstract specs without needing package information - try: - spack.variant.substitute_abstract_variants(test_spec) - except spack.variant.UnknownVariantError: - pass - if any(test_spec.satisfies(x) for x in excludes): - continue - # If no broadcast, this is [(,)]. # It will run once, as required, and apply no constraints for broadcast_combo in broadcast_constraints: final_combo = [_apply_broadcast(spec.copy(), broadcast_combo) for spec in flat_combo] + # Check whether final spec is excluded + # requires constructing a spec from constraints + test_spec = final_combo[0].copy() + for constraint in final_combo[1:]: + test_spec.constrain(constraint) + + # Abstract variants don't have normal satisfaction semantics + # Convert all variants to concrete types. + # This method is best effort, so all existing variants will be + # converted before any error is raised. + # Catch exceptions because we want to be able to operate on + # abstract specs without needing package information + try: + spack.variant.substitute_abstract_variants(test_spec) + except spack.variant.UnknownVariantError: + pass + + # actual exclusion check is here + if any(test_spec.satisfies(e) for e in excludes): + continue + + # Apply sigil if applicable if sigil: final_combo[0] = Spec(sigil + str(final_combo[0]))