Source code for spack.solver.error
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Errors raised by the concretizer.
This module holds no solver state, so that both the solver and the types it produces can
depend on it without importing each other.
"""
from typing import List, Optional, Tuple
import spack.error
import spack.spec
[docs]
class UnsatisfiableSpecError(spack.error.UnsatisfiableSpecError):
"""There was an issue with the spec that was requested (i.e. a user error)."""
def __init__(self, msg):
super(spack.error.UnsatisfiableSpecError, self).__init__(msg)
self.provided = None
self.required = None
self.constraint_type = None
[docs]
class InternalConcretizerError(spack.error.UnsatisfiableSpecError):
"""Errors that indicate a bug in Spack."""
def __init__(self, msg):
super(spack.error.UnsatisfiableSpecError, self).__init__(msg)
self.provided = None
self.required = None
self.constraint_type = None
[docs]
class SolverError(InternalConcretizerError):
"""For cases where the solver is unable to produce a solution.
Such cases are unexpected because we allow for solutions with errors,
so for example user specs that are over-constrained should still
get a solution.
"""
def __init__(self, provided):
msg = (
"Spack concretizer internal error. Please submit a bug report at "
"https://github.com/spack/spack and include the command and environment "
"if applicable."
f"\n {provided} is unsatisfiable"
)
super().__init__(msg)
# Add attribute expected of the superclass interface
self.required = None
self.constraint_type = None
self.provided = provided
[docs]
class InvalidSpliceError(spack.error.SpackError):
"""For cases in which the splice configuration is invalid."""
[docs]
class SpliceSerializationError(spack.error.SpackError):
"""Attempt to serialize a SpecDict that contains spliced specs (currently unsupported)."""
[docs]
class InvalidVersionError(spack.error.SpackError):
"""Raised when a version can't be satisfied by any possible versions."""
[docs]
class InvalidDependencyError(spack.error.SpackError):
"""Raised when an explicit dependency is not a possible dependency."""