From 51a60d2180fe909a5ba48ce13dc3f42ccfb79bfb Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 3 Apr 2018 13:21:39 -0400 Subject: [PATCH] skip complex comparison for constraints without markers We're seeing parse errors on constraints with no markers, possibly related to a unicode issue (it only seems to happen when the empty marker string is a unicode string). There isn't any point in doing an expensive comparison when there are no markers for the constraint, so skip them in that part of the search loop. Change-Id: I2a700fb8f3e776faf6123c9924d87add12324ef2 Signed-off-by: Doug Hellmann --- openstack_requirements/check.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openstack_requirements/check.py b/openstack_requirements/check.py index 4e9cb2699b..cd4b49d550 100644 --- a/openstack_requirements/check.py +++ b/openstack_requirements/check.py @@ -204,6 +204,13 @@ def _find_constraint(req, constraints): for constraint_setting, _ in constraints: if constraint_setting.markers == req.markers: return constraint_setting + if not constraint_setting.markers: + # There is no point in performing the complex + # comparison for a constraint that has no markers, so + # we skip it here. If we find no closer match then the + # loop at the end of the function will look for a + # constraint without a marker and use that. + continue # NOTE(dhellmann): This is a very naive attempt to check # marker compatibility that relies on internal # implementation details of the packaging library. The