summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-14 07:52:45 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-14 07:52:45 +0000
commitce687962e8c9668b1f2db65b19664c265fcc22b4 (patch)
tree239a1d585fed92feecf259d4edcd9e1cbc5ab39d
parent2302543742e973cc6ac1026ab88a5abec04f6c69 (diff)
downloadportage-ce687962e8c9668b1f2db65b19664c265fcc22b4.tar.gz
portage-ce687962e8c9668b1f2db65b19664c265fcc22b4.tar.bz2
portage-ce687962e8c9668b1f2db65b19664c265fcc22b4.zip
Use a regular expression for cpv_getkey(), and fall back to legacy code if
no match is found. svn path=/main/trunk/; revision=14259
-rw-r--r--pym/portage/__init__.py5
-rw-r--r--pym/portage/dep.py1
2 files changed, 6 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index c842f27e3..adf306963 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7994,6 +7994,11 @@ def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
return deplist
def cpv_getkey(mycpv):
+ m = dep._cpv_re.search(mycpv)
+ if m is not None and m.group(2) is not None:
+ return m.group(2)
+
+ # Fall back to legacy code for backward compatibility.
myslash=mycpv.split("/")
mysplit=pkgsplit(myslash[-1])
if mysplit is None:
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index 929e31dbe..12e26ab87 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -895,6 +895,7 @@ _use = r'(\[.*\])?'
_op = r'([=~]|[><]=?)'
_cp = '(' + _cat + '/' + _pkg + '(-' + _version + ')?)'
_cpv = '(' + _cp + '-' + _version + ')'
+_cpv_re = re.compile(_cpv)
_atom_re = re.compile('^(?:' +
'(?P<op>' + _op + _cpv + ')|' +