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.
This commit is contained in:
parent
c16a68f517
commit
101693d823
@ -1985,10 +1985,19 @@ def _merge_dependency(self, dep, deptypes, visited, spec_deps,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user