Commit 52ac25dc authored by Reinout van Rees's avatar Reinout van Rees

Made the version constraint error message more clear

Previously:

    The constraint, 1.6.6, is not consistent with the requirement, 'Django>=1.7'.
    While:
      Updating django.
    Error: Bad constraint 1.6.6 Django>=1.7

Now:

    While:
      Installing django.
    Error: The requirement ('Django>=1.7') is not allowed by your [versions] constraint (1.6.6)

The original message said "bad constraint". No, the constraint is not
necessarily bad. It only conflicts with some other package's requirement.

The new message tells you that "constraint" means "your own [versions]
list".
parent cc0c0d4f
......@@ -1505,7 +1505,9 @@ def _constrained_requirement(constraint, requirement):
assert constraint.startswith('==')
constraint = constraint[2:]
if constraint not in requirement:
bad_constraint(constraint, requirement)
msg = ("The requirement (%r) is not allowed by your [versions] "
"constraint (%s)" % (str(requirement), constraint))
raise IncompatibleConstraintError(msg)
# Sigh, copied from Requirement.__str__
extras = ','.join(requirement.extras)
......@@ -1528,8 +1530,3 @@ class IncompatibleConstraintError(zc.buildout.UserError):
"""
IncompatibleVersionError = IncompatibleConstraintError # Backward compatibility
def bad_constraint(constraint, requirement):
logger.error("The constraint, %s, is not consistent with the "
"requirement, %r.", constraint, str(requirement))
raise IncompatibleConstraintError("Bad constraint", constraint, requirement)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment