commit 6f5399d1c61f6323a412e60e6b6b080f600b8ef3 Author: Michal Srb msrb@redhat.com Date: Tue Dec 2 16:18:37 2014 +0100
[osgi] Implement __eq__() and __ne__() in OSGiBundle
python/javapackages/common/osgi.py | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) --- diff --git a/python/javapackages/common/osgi.py b/python/javapackages/common/osgi.py index b277b78..7a33361 100644 --- a/python/javapackages/common/osgi.py +++ b/python/javapackages/common/osgi.py @@ -153,6 +153,18 @@ class OSGiBundle(object): return cls(bundle, version=version, namespace=namespace, requires=requires)
+ def __eq__(self, other): + if not isinstance(other, (OSGiBundle, OSGiRequire)): + return False + if self.bundle != other.bundle: + return False + if self.namespace != other.namespace: + return False + return True + + def __ne__(self, other): + return not self.__eq__(other) + def get_rpm_str(self, version="", namespace=""): return "{ns}{d}osgi({bundle}) = {version}".format(ns=namespace or self.namespace, d="-" if self.namespace else "",
java-sig-commits@lists.fedoraproject.org