summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-27 19:07:57 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-27 19:07:57 +0000
commitbaa98e52b624fa40d6bc2e8c4ead269990bb3c05 (patch)
tree41e1c7490459607281554c54e7b70bfa90b0e4a8
parent99f5234e3fe471874b3681dd5b29cc8132d4fbdb (diff)
downloadportage-baa98e52b624fa40d6bc2e8c4ead269990bb3c05.tar.gz
portage-baa98e52b624fa40d6bc2e8c4ead269990bb3c05.tar.bz2
portage-baa98e52b624fa40d6bc2e8c4ead269990bb3c05.zip
Use catsplit() instead of a regex to generate dbapi._categories. Thanks to
Marat Radchenko <marat@slonopotamus.org> for this patch. svn path=/main/trunk/; revision=14448
-rw-r--r--pym/portage/dbapi/__init__.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index c904d5d2c..53358c829 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -12,7 +12,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.locks:unlockfile',
'portage.output:colorize',
'portage.util:cmp_sort_key,writemsg',
- 'portage.versions:catpkgsplit,vercmp',
+ 'portage.versions:catsplit,catpkgsplit,vercmp',
)
from portage import os
@@ -39,11 +39,8 @@ class dbapi(object):
"""
if self._categories is not None:
return self._categories
- categories = set()
- cat_pattern = re.compile(r'(.*)/.*')
- for cp in self.cp_all():
- categories.add(cat_pattern.match(cp).group(1))
- self._categories = tuple(sorted(categories))
+ self._categories = tuple(sorted(set(catsplit(x)[0] \
+ for x in self.cp_all())))
return self._categories
def close_caches(self):