From 3f3bcacd16f9f07888e7dd31ddbd8536adc2bbd7 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Mon, 16 May 2022 12:20:30 -0700 Subject: [PATCH] flake --- lib/spack/spack/solver/asp.py | 36 ++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 3d3a8fbf0e7..2aa3569c8a5 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -54,6 +54,7 @@ ASTType = None parse_files = None + # backward compatibility functions for clingo ASTs def ast_getter(*names): def getter(node): @@ -840,7 +841,7 @@ def pkg_rules(self, pkg, tests): for w in when: msg = "%s has variant %s" % (pkg.name, name) if str(w): - msg += " when %s" % w + msg += " when %s" % w cond_id = self.condition(w, name=pkg.name, msg=msg) self.gen.fact(fn.variant_condition(cond_id, pkg.name, name)) @@ -1943,10 +1944,12 @@ def version_unsatisfiable(self, pkg, constraint): raise UnsatisfiableSpecError("%s spec cannot satisfy @%s" % (pkg, constraint)) def no_variant_value(self, pkg, variant): - raise UnsatisfiableSpecError("No satisfying value for variant %s of package %s" % (variant, pkg)) + raise UnsatisfiableSpecError( + "No satisfying value for variant %s of package %s" % (variant, pkg)) def multiple_values_sv_variant(self, pkg, variant, value1, value2): - msg = "'%s' spec requested multiple values for single-valued variant %s" % (pkg, variant) + msg = "'%s' required multiple values for single-valued variant %s" % (pkg, + variant) msg += "\n requested %s and %s" % (value1, value2) raise UnsatisfiableSpecError(msg) @@ -1957,7 +1960,8 @@ def unnecessary(self, pkg): raise UnsatisfiableSpecError("something doesn't depend on package %s" % pkg) def cyclic_dependency(self, pkg1, pkg2): - raise UnsatisfiableSpecError("Cyclic dependency between %s and %s" % (pkg1, pkg2)) + raise UnsatisfiableSpecError("Cyclic dependency between %s and %s" % + (pkg1, pkg2)) def no_provider(self, virtual): raise UnsatisfiableSpecError("No provider for virtual %s" % virtual) @@ -1969,10 +1973,14 @@ def invalid_external_spec(self, pkg): raise UnsatisfiableSpecError("Invalid external spec") def inactive_variant_set(self, pkg, variant): - raise UnsatisfiableSpecError("Cannot set conditional variant %s for package %s that cannot be satisfied" % (variant, pkg)) + msg = "Cannot set variant '%s' for package '%s'" % (variant, pkg) + msg += " because the variant condition cannot be satisfied for the given spec" + raise UnsatisfiableSpecError(msg) def disjoint_variant_values(self, pkg, variant, value1, value2): - msg = "%s variant %s cannot have both values %s and %s, as they come from disjoing value sets" % (pkg, variant, value1, value2) + msg = "%s variant %s cannot have both values %s and %s," % ( + pkg, variant, value1, value2) + msg += " as they come from disjoint value sets" raise UnsatisfiableSpecError(msg) def variant_none_and_other(self, pkg, variant, value): @@ -1991,7 +1999,8 @@ def os_not_buildable(self, pkg, os1): raise UnsatisfiableSpecError(msg) def os_incompatible(self, pkg, dep, p_os, d_os): - msg = "%s and dependency %s have incompatible OSs %s and %s" % (pkg, dep, p_os, d_os) + msg = "%s and dependency %s have incompatible OSs %s and %s" % ( + pkg, dep, p_os, d_os) raise UnsatisfiableSpecError(msg) def no_target(self, pkg): @@ -2021,7 +2030,8 @@ def no_compiler_version(self, pkg): raise UnsatisfiableSpecError("%s has no compiler version" % pkg) def multiple_compiler_versions(self, pkg, compiler1, ver1, compiler2, ver2): - msg = "%s compilers %s@%s and %s@%s incompatible" % (pkg, compiler1, ver1, compiler2, ver2) + msg = "%s compilers %s@%s and %s@%s incompatible" % ( + pkg, compiler1, ver1, compiler2, ver2) raise UnsatisfiableSpecError(msg) def compiler_os_mismatch(self, pkg, compiler, version, os): @@ -2032,7 +2042,8 @@ def no_platform(self, pkg): raise UnsatisfiableSpecError("No satisfiable platform found for %s" % pkg) def multiple_platforms(self, pkg, platform1, platform2): - msg = "%s requires incompatible platforms %s and %s" % (pkg, platform1, platform2) + msg = "%s requires incompatible platforms %s and %s" % ( + pkg, platform1, platform2) raise UnsatisfiableSpecError(msg) def variant_value(self, pkg, name, value): @@ -2186,9 +2197,11 @@ def build_specs(self, function_tuples): assert action and callable(action) # ignore predicates on virtual packages, as they're used for - # solving but don't construct anything + # solving but don't construct anything. Do not ignore error + # predicates on virtual packages. pkg = args[0] - if spack.repo.path.is_virtual(pkg) and name not in ("no_provider", "multiple_providers"): + if spack.repo.path.is_virtual(pkg) and name not in ("no_provider", + "multiple_providers"): continue # if we've already gotten a concrete spec for this pkg, @@ -2328,6 +2341,7 @@ def __init__(self, msg): self.required = None self.constraint_type = None + class InternalConcretizerError(spack.error.UnsatisfiableSpecError): """ Subclass for new constructor signature for new concretizer