diff options
author | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2017-08-17 08:26:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-17 08:26:04 +0200 |
commit | 101693d8233b97e6af986534ff3d8a647de0094d (patch) | |
tree | 92ffe01f0e58e6545b8e8f447550b1de8730aa27 /lib | |
parent | c16a68f517ca1bd08a7dde454fac850e4c3b6013 (diff) | |
download | spack-101693d8233b97e6af986534ff3d8a647de0094d.tar.gz spack-101693d8233b97e6af986534ff3d8a647de0094d.tar.bz2 spack-101693d8233b97e6af986534ff3d8a647de0094d.tar.xz spack-101693d8233b97e6af986534ff3d8a647de0094d.zip |
Improved error message for unsatisfiable specs (#5113)
* Improved error message for unsatisfiable specs. fixes #5066
This PR improves the error message for unsatisfiable specs by showing in tree format both the spec that cannot satisfy the constraint and the spec that asked for that constraint. After that follows a readable error message.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/spec.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 32e08d3896..05db84806f 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -1985,10 +1985,19 @@ class Spec(object): try: changed |= spec_deps[dep.name].constrain(dep) except UnsatisfiableSpecError as e: - e.message = "Invalid spec: '%s'. " - e.message += "Package %s requires %s %s, but spec asked for %s" - e.message %= (spec_deps[dep.name], dep.name, - e.constraint_type, e.required, e.provided) + fmt = 'An unsatisfiable {0}'.format(e.constraint_type) + fmt += ' constraint has been detected for spec:' + fmt += '\n\n{0}\n\n'.format(spec_deps[dep.name].tree(indent=4)) + fmt += 'while trying to concretize the partial spec:' + fmt += '\n\n{0}\n\n'.format(self.tree(indent=4)) + fmt += '{0} requires {1} {2} {3}, but spec asked for {4}' + e.message = fmt.format( + self.name, + dep.name, + e.constraint_type, + e.required, + e.provided + ) raise e # Add merged spec to my deps and recurse |