From ac538fdb387b5a5a4c4bb481af95deb739edd70b Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 2 Apr 2013 18:08:02 -0700 Subject: [PATCH] Fix comparison between Python Requirement objects. pkg_resources.Requirement implements __eq__() but not __ne__(). There is no implied relationship between __eq__() and __ne__() so we must negate the result of == instead of using !=. Change-Id: Ie83f87687f5666e6511265f2b9acdd42f38f1dd2 Reviewed-on: https://review.openstack.org/25974 Reviewed-by: Jeremy Stanley Approved: James E. Blair Reviewed-by: James E. Blair Tested-by: Jenkins --- .../files/slave_scripts/project-requirements-change.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/jenkins/files/slave_scripts/project-requirements-change.py b/modules/jenkins/files/slave_scripts/project-requirements-change.py index 30acf7e6a5..4cb86f1833 100755 --- a/modules/jenkins/files/slave_scripts/project-requirements-change.py +++ b/modules/jenkins/files/slave_scripts/project-requirements-change.py @@ -90,7 +90,10 @@ def main(): if name not in os_reqs.reqs: print("Requirement %s not in openstack/requirements" % str(req)) failed = True - if req != os_reqs.reqs[name]: + # pkg_resources.Requirement implements __eq__() but not __ne__(). + # There is no implied relationship between __eq__() and __ne__() + # so we must negate the result of == here instead of using !=. + if not (req == os_reqs.reqs[name]): print("Requirement %s does not match openstack/requirements " "value %s" % (str(req), str(os_reqs.reqs[name]))) failed = True