fix a possibility of a None type error in exclDictMatchCP
authordol-sen <brian.dolbec@gmail.com>
Wed, 13 Jul 2011 05:34:01 +0000 (22:34 -0700)
committerdol-sen <brian.dolbec@gmail.com>
Wed, 13 Jul 2011 05:34:01 +0000 (22:34 -0700)
pym/gentoolkit/eclean/exclude.py

index 5f48cab91234ebf67c8871140c7e4cfd369ddc33..961bb145ffd3990c2e5a28f8f3b4e85ba08f2f71 100644 (file)
@@ -199,13 +199,20 @@ def exclDictExpand(exclude):
 
 def exclDictMatchCP(exclude,pkg):
        """Checks whether a CP matches the exclusion rules."""
+       if pkg is None:
+               return False
        if 'anti-packages' in exclude and pkg in exclude['anti-packages']:
                return False
        if 'packages' in exclude and pkg in exclude['packages']:
                return True
-       cat = pkg.split('/')[0]
+       try:
+               cat = pkg.split('/')[0]
+       except:
+               dprint( "exclude", "exclDictMatchCP: Invalid package name: " +\
+                       "%s, Could not determine category" %pkg)
+               cat = ''
        if 'categories' in exclude and cat in exclude['categories']:
-               return True
+                       return True
        return False
 
 def exclDictExpandPkgname(exclude):