error messages: use production quality messages

This commit is contained in:
Gregory Becker
2022-05-17 11:11:50 -07:00
parent ae68318475
commit ce53ce284b

View File

@@ -1966,43 +1966,57 @@ def conflict_triggered(self, msg):
raise UnsatisfiableSpecError(msg)
def no_version(self, pkg):
raise UnsatisfiableSpecError("No versions available for package %s" % pkg)
raise UnsatisfiableSpecError("No versions available for package '%s'" % pkg)
def versions_conflict(self, pkg, version1, version2):
msg = "No version for %s satisfies @%s and @%s" % (pkg, version1, version2)
msg = ("No version for '%s' satisfies '@%s' and '@%s'" %
(pkg, version1, version2))
raise UnsatisfiableSpecError(msg)
def version_unsatisfiable(self, pkg, constraint):
raise UnsatisfiableSpecError("%s spec cannot satisfy @%s" % (pkg, constraint))
msg = "No valid version for '%s' satisfies '@%s'" % (pkg, constraint)
raise UnsatisfiableSpecError(msg)
def no_variant_value(self, pkg, variant):
raise UnsatisfiableSpecError(
"No satisfying value for variant %s of package %s" % (variant, pkg))
msg = "No valid variant '%s' of package '%s'" % (variant, pkg)
raise UnsatisfiableSpecError(msg)
def multiple_values_sv_variant(self, pkg, variant, value1, value2):
variant1 = spack.spec.Spec('%s=%s' % (variant, value1))
variant2 = spack.spec.Spec('%s=%s' % (variant, value2))
msg = "'%s' required multiple values for single-valued variant %s" % (pkg,
variant)
msg += "\n requested %s and %s" % (value1, value2)
msg += "\n requested %s and %s" % (variant1, variant2)
raise UnsatisfiableSpecError(msg)
def invalid_variant_value(self, pkg, variant, value):
raise UnsatisfiableSpecError("Invalid variant value")
formatted = spack.spec.Spec('%s=%s' % (variant, value))
msg = ("'%s' is not a valid value for '%s' variant '%s'" %
(formatted, pkg, variant))
raise UnsatisfiableSpecError(msg)
def unnecessary(self, pkg):
raise UnsatisfiableSpecError("something doesn't depend on package %s" % pkg)
msg = "'%s' is not a valid dependency for any package" % pkg
raise UnsatisfiableSpecError(msg)
def cyclic_dependency(self, pkg1, pkg2):
raise UnsatisfiableSpecError("Cyclic dependency between %s and %s" %
(pkg1, pkg2))
msg = "Cyclic dependency detected between '%s' an '%s'" % (pkg1, pkg2)
msg += "\n Consider changing variants to avoid the cyclic dependency"
raise UnsatisfiableSpecError(msg)
def no_provider(self, virtual):
raise UnsatisfiableSpecError("No provider for virtual %s" % virtual)
msg = "Cannot find valid provider for virtual %s" % virtual
raise UnsatisfiableSpecError(msg)
def multiple_providers(self, virtual, provider1, provider2):
raise UnsatisfiableSpecError("Multiple providers")
msg = "Spec cannot include multiple providers for virtual '%s'" % virtual
msg += "\n Requested %s and %s" % (provider1, provider2)
raise UnsatisfiableSpecError(msg)
def invalid_external_spec(self, pkg):
raise UnsatisfiableSpecError("Invalid external spec")
msg = "Attempted to use external for '%s'" % pkg
msg += " which does not satisfy any configured external spec"
raise UnsatisfiableSpecError(msg)
def inactive_variant_set(self, pkg, variant):
msg = "Cannot set variant '%s' for package '%s'" % (variant, pkg)
@@ -2016,46 +2030,53 @@ def disjoint_variant_values(self, pkg, variant, value1, value2):
raise UnsatisfiableSpecError(msg)
def variant_none_and_other(self, pkg, variant, value):
msg = "%s variant %s cannot have values %s and 'none'" % (pkg, variant, value)
msg = ("%s variant '%s' cannot have values '%s' and 'none'" %
(pkg, variant, value))
raise UnsatisfiableSpecError(msg)
def no_os(self, pkg):
raise UnsatisfiableSpecError("No os for %s" % pkg)
msg = "Cannot find valid operating system for '%s'" % pkg
raise UnsatisfiableSpecError(msg)
def multiple_os(self, pkg, os1, os2):
msg = "Multiple OS for %s: %s and %s" % (pkg, os1, os2)
msg = "Cannot concretize %s with multiple operating systems" % pkg
msg += "\n Requested 'os=%s' and 'os=%s'" % (os1, os2)
raise UnsatisfiableSpecError(msg)
def os_not_buildable(self, pkg, os1):
msg = "%s os %s is not buildable" % (pkg, os1)
msg = "Cannot concretize '%s os=%s'." % (pkg, os1)
msg += " Operating system '%s' is not buildable" % 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 operating systems" % (pkg, dep)
msg += "'os=%s' and 'os=%s'" % (p_os, d_os)
raise UnsatisfiableSpecError(msg)
def no_target(self, pkg):
raise UnsatisfiableSpecError("%s has no target" % pkg)
msg = "Cannot find valid target for '%s'" % pkg
raise UnsatisfiableSpecError(msg)
def multiple_targets(self, pkg, target1, target2):
msg = "%s has multiple targets, %s and %s" % (pkg, target1, target2)
msg = "Cannot concretize %s with multiple targets" % pkg
msg += "\n Requested 'target=%s' and 'target=%s'" % (target1, target2)
raise UnsatisfiableSpecError(msg)
def target_unsatisfiable(self, pkg, target, constraint):
msg = "%s target cannot satisfy constraint %s" % (pkg, constraint)
msg = "%s cannot satisfy constraint 'target=%s'" % (pkg, constraint)
raise UnsatisfiableSpecError(msg)
def target_incompatible(self, pkg, dep):
msg = "No compatible targets possible for %s and %s" % (pkg, dep)
msg = "Cannot find compatible targets for %s and %s" % (pkg, dep)
raise UnsatisfiableSpecError(msg)
def compiler_target_mismatch(self, pkg, target, compiler, version):
msg = "%s compiler %s@%s incompatible with target %s"
msg = ("%s compiler %s@%s incompatible with target %s" %
(pkg, compiler, version, target))
raise UnsatisfiableSpecError(msg)
def invalid_target(self, pkg, target):
msg = "%s target %s is not compatible with this machine" % (pkg, target)
msg = "'%s target=%s' is not compatible with this machine" % (pkg, target)
raise UnsatisfiableSpecError(msg)
def no_compiler_version(self, pkg):
@@ -2067,15 +2088,16 @@ def multiple_compiler_versions(self, pkg, compiler1, ver1, compiler2, ver2):
raise UnsatisfiableSpecError(msg)
def compiler_os_mismatch(self, pkg, compiler, version, os):
msg = "%s compiler %s@%s incompatible with os %s" % (pkg, compiler, version, os)
msg = ("%s compiler '%s@%s' incompatible with 'os=%s'" %
(pkg, compiler, version, os))
raise UnsatisfiableSpecError(msg)
def no_platform(self, pkg):
raise UnsatisfiableSpecError("No satisfiable platform found for %s" % pkg)
raise UnsatisfiableSpecError("No valid platform found for %s" % pkg)
def multiple_platforms(self, pkg, platform1, platform2):
msg = "%s requires incompatible platforms %s and %s" % (
pkg, platform1, platform2)
msg = "Cannot concretize %s with multiple platforms" % pkg
msg += "\n Requested 'platform=%s' and 'platform=%s'" % (platform1, platform2)
raise UnsatisfiableSpecError(msg)
def variant_value(self, pkg, name, value):