* fix: dependency comparison stuff

this is really not my fault. somebody had misunderstood
  that code and had overwritten it with something. when i
  got around to rewriting i have been careless!!!
This commit is contained in:
Eray Özkural
2006-03-17 14:32:34 +00:00
parent 3e34e0b76c
commit 60b21c7370
+9 -2
View File
@@ -29,8 +29,10 @@ class Dependency:
__metaclass__ = autoxml.autoxml __metaclass__ = autoxml.autoxml
s_Package = [autoxml.String, autoxml.mandatory] s_Package = [autoxml.String, autoxml.mandatory]
a_version = [autoxml.String, autoxml.optional]
a_versionFrom = [autoxml.String, autoxml.optional] a_versionFrom = [autoxml.String, autoxml.optional]
a_versionTo = [autoxml.String, autoxml.optional] a_versionTo = [autoxml.String, autoxml.optional]
a_release = [autoxml.String, autoxml.optional]
a_releaseFrom = [autoxml.String, autoxml.optional] a_releaseFrom = [autoxml.String, autoxml.optional]
a_releaseTo = [autoxml.String, autoxml.optional] a_releaseTo = [autoxml.String, autoxml.optional]
@@ -50,14 +52,19 @@ class Dependency:
"""determine if a package ver. satisfies given dependency spec""" """determine if a package ver. satisfies given dependency spec"""
ret = True ret = True
v = Version(version) v = Version(version)
if self.version:
ret &= v == Version(self.version)
if self.versionFrom: if self.versionFrom:
ret &= v >= Version(self.versionFrom) ret &= v >= Version(self.versionFrom)
if self.versionTo: if self.versionTo:
ret &= v <= Version(self.versionTo) ret &= v <= Version(self.versionTo)
r = Version(release)
if self.release:
ret &= r == Version(self.release)
if self.releaseFrom: if self.releaseFrom:
ret &= v <= Version(self.releaseFrom) ret &= r >= Version(self.releaseFrom)
if self.releaseTo: if self.releaseTo:
ret &= v <= Version(self.releaseTo) ret &= r <= Version(self.releaseTo)
return ret return ret
def dict_satisfies_dep(dict, depinfo): def dict_satisfies_dep(dict, depinfo):