helpers: convert get_cpvs output to a set before calculating len()
authorW. Trevor King <wking@tremily.us>
Mon, 12 Nov 2012 02:06:58 +0000 (21:06 -0500)
committerW. Trevor King <wking@tremily.us>
Mon, 12 Nov 2012 02:06:58 +0000 (21:06 -0500)
This avoids "TypeError: object of type 'generator' has no len()".

pym/gentoolkit/helpers.py

index 706b5261318bbb38a6db00cd94648fcdeb44533b..cc3bf3500a1f6c2265c69ebe3f0461d9c11edb57 100644 (file)
@@ -373,7 +373,7 @@ def get_cpvs(predicate=None, include_installed=True):
                >>> len(set(get_cpvs()))
                26065
                >>> fn = lambda x: x.startswith('app-portage')
-               >>> len(get_cpvs(fn, include_installed=False))
+               >>> len(set(get_cpvs(fn, include_installed=False)))
                112
 
        @type predicate: function