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 <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Clark Boylan 2013-04-02 18:08:02 -07:00 committed by Jenkins
parent f2ba2d9146
commit ac538fdb38

View File

@ -90,7 +90,10 @@ def main():
if name not in os_reqs.reqs: if name not in os_reqs.reqs:
print("Requirement %s not in openstack/requirements" % str(req)) print("Requirement %s not in openstack/requirements" % str(req))
failed = True 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 " print("Requirement %s does not match openstack/requirements "
"value %s" % (str(req), str(os_reqs.reqs[name]))) "value %s" % (str(req), str(os_reqs.reqs[name])))
failed = True failed = True