Make cpv_getversion handle invalid cpv and add cpv_getversion to __all__.
authorZac Medico <zmedico@gentoo.org>
Sat, 10 Apr 2010 21:11:47 +0000 (14:11 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 Apr 2010 21:11:47 +0000 (14:11 -0700)
pym/portage/versions.py

index 89ab6e180eb215844c9b884863e8c891f4b0ba75..1db421a7e9837a910d8c4759d401469d60fe1ceb 100644 (file)
@@ -4,7 +4,7 @@
 
 __all__ = [
        'best', 'catpkgsplit', 'catsplit',
-       'cpv_getkey', 'pkgcmp',  'pkgsplit',
+       'cpv_getkey', 'cpv_getversion', 'pkgcmp',  'pkgsplit',
        'ververify', 'vercmp'
 ]
 
@@ -338,6 +338,8 @@ def cpv_getkey(mycpv):
 def cpv_getversion(mycpv):
        """Returns the v (including revision) from an cpv."""
        cp = cpv_getkey(mycpv)
+       if cp is None:
+               return None
        return mycpv[len(cp+"-"):]
 
 def catsplit(mydep):