Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r14448 - main/trunk/pym/portage/dbapi
Date: Sun, 27 Sep 2009 19:07:59
Message-Id: E1Mrz6D-0007Wt-Fs@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-09-27 19:07:57 +0000 (Sun, 27 Sep 2009)
3 New Revision: 14448
4
5 Modified:
6 main/trunk/pym/portage/dbapi/__init__.py
7 Log:
8 Use catsplit() instead of a regex to generate dbapi._categories. Thanks to
9 Marat Radchenko <marat@××××××××××××.org> for this patch.
10
11
12 Modified: main/trunk/pym/portage/dbapi/__init__.py
13 ===================================================================
14 --- main/trunk/pym/portage/dbapi/__init__.py 2009-09-27 18:30:44 UTC (rev 14447)
15 +++ main/trunk/pym/portage/dbapi/__init__.py 2009-09-27 19:07:57 UTC (rev 14448)
16 @@ -12,7 +12,7 @@
17 'portage.locks:unlockfile',
18 'portage.output:colorize',
19 'portage.util:cmp_sort_key,writemsg',
20 - 'portage.versions:catpkgsplit,vercmp',
21 + 'portage.versions:catsplit,catpkgsplit,vercmp',
22 )
23
24 from portage import os
25 @@ -39,11 +39,8 @@
26 """
27 if self._categories is not None:
28 return self._categories
29 - categories = set()
30 - cat_pattern = re.compile(r'(.*)/.*')
31 - for cp in self.cp_all():
32 - categories.add(cat_pattern.match(cp).group(1))
33 - self._categories = tuple(sorted(categories))
34 + self._categories = tuple(sorted(set(catsplit(x)[0] \
35 + for x in self.cp_all())))
36 return self._categories
37
38 def close_caches(self):