Allow comparing Version objects with strings

This commit is contained in:
Fatih Aşıcı
2010-02-05 14:53:02 +00:00
parent 897a0442cf
commit 174db8b712
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -1,3 +1,7 @@
2010-02-05 Fatih Aşıcı <fatih@pardus.org.tr>
* pisi/version.py (compare): Allow comparing Version objects
with strings.
2010-02-04 Ozan Çağlayan <ozan@pardus.org.tr>
* pisi/pxml/autoxml.py (format): Some optional elements may be None
during formatting, handle those situations. We still have a formatting
+4
View File
@@ -182,6 +182,10 @@ class Version:
not we use the comparison operator. And we iterate to the left.
The result is, 0 if two are equal, -1 if self < rhs, and +1
if self>rhs"""
if isinstance(ver, basestring):
ver = pisi.version.Version(ver)
lhs = self.comps
rhs = ver.comps
# pad the short version string with zeros