spack audit: fix API calls (#27713)

This broke in #24858
This commit is contained in:
Massimiliano Culpo 2021-11-30 14:59:55 +01:00 committed by GitHub
parent 5044df88ab
commit 645a7dc14c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -389,9 +389,8 @@ def _unknown_variants_in_dependencies(pkgs, error_cls):
dependency_variants = dependency_edge.spec.variants dependency_variants = dependency_edge.spec.variants
for name, value in dependency_variants.items(): for name, value in dependency_variants.items():
try: try:
dependency_pkg.variants[name].validate_or_raise( v, _ = dependency_pkg.variants[name]
value, pkg=dependency_pkg v.validate_or_raise(value, pkg=dependency_pkg)
)
except Exception as e: except Exception as e:
summary = (pkg_name + ": wrong variant used for a " summary = (pkg_name + ": wrong variant used for a "
"dependency in a 'depends_on' directive") "dependency in a 'depends_on' directive")
@ -419,7 +418,8 @@ def _analyze_variants_in_directive(pkg, constraint, directive, error_cls):
errors = [] errors = []
for name, v in constraint.variants.items(): for name, v in constraint.variants.items():
try: try:
pkg.variants[name].validate_or_raise(v, pkg=pkg) variant, _ = pkg.variants[name]
variant.validate_or_raise(v, pkg=pkg)
except variant_exceptions as e: except variant_exceptions as e:
summary = pkg.name + ': wrong variant in "{0}" directive' summary = pkg.name + ': wrong variant in "{0}" directive'
summary = summary.format(directive) summary = summary.format(directive)