Check vercmp() return value to avoid arbitrary results in case it returns None
authorMarius Mauch <genone@gentoo.org>
Tue, 13 May 2008 19:36:33 +0000 (19:36 -0000)
committerMarius Mauch <genone@gentoo.org>
Tue, 13 May 2008 19:36:33 +0000 (19:36 -0000)
svn path=/main/trunk/; revision=10322

pym/portage/versions.py

index 11506457816b8d8a73359e4fc287d1d2d3f74b9e..4a12ef9d596d1e00b6f03c4cfb672f13c2b53223 100644 (file)
@@ -190,9 +190,11 @@ def pkgcmp(pkg1, pkg2):
        if pkg1[0] != pkg2[0]:
                return None
        mycmp = vercmp("-".join(pkg1[1:]), "-".join(pkg2[1:]))
-       if mycmp>0:
+       if mycmp is None:
+               return mycmp
+       if mycmp > 0:
                return 1
-       if mycmp<0:
+       if mycmp < 0:
                return -1
        return 0