Add check for prerelease and further clean up error message.

Change-Id: I3b29dd606e76c7855ff34decf29caf9417f1cf44
This commit is contained in:
Matthew Thode 2019-01-18 10:58:13 -06:00
parent 18480cc7cf
commit 7d6051949f
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8

View File

@ -92,11 +92,12 @@ def check_compatible(global_reqs, constraints):
tested = []
for constraint, _ in reqs[name]:
spec = specifiers.SpecifierSet(constraint.specifiers)
if spec.contains(version):
# pre-releases are allowed by policy but discouraged
if spec.contains(version, prereleases=True):
return True
tested.append(constraint.specifiers)
failures.append('Constraint for %s==%s does not match requirement %s' %
(name, version, tested))
failures.append('Constraint %s for %s does not match requirement %s' %
(version, name, tested))
return False
failures = []
for pkg_constraints in constraints.values():