From baa98e52b624fa40d6bc2e8c4ead269990bb3c05 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 27 Sep 2009 19:07:57 +0000 Subject: Use catsplit() instead of a regex to generate dbapi._categories. Thanks to Marat Radchenko for this patch. svn path=/main/trunk/; revision=14448 --- pym/portage/dbapi/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'pym') 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): -- cgit v1.2.3-1-g7c22