From 7d6051949fdd15879fc1fa19cabeaee5802523af Mon Sep 17 00:00:00 2001 From: Matthew Thode Date: Fri, 18 Jan 2019 10:58:13 -0600 Subject: [PATCH] Add check for prerelease and further clean up error message. Change-Id: I3b29dd606e76c7855ff34decf29caf9417f1cf44 --- openstack_requirements/constraints.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openstack_requirements/constraints.py b/openstack_requirements/constraints.py index 09148b92b5..9c8c4c402e 100644 --- a/openstack_requirements/constraints.py +++ b/openstack_requirements/constraints.py @@ -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():