From 160e54481cfd26ac81c8bb1cb919656e52cc185c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 14 Sep 2009 08:24:30 +0000 Subject: [PATCH] Simplify cpv_getkey() by just calling dep_getkey('=' + mycpv). svn path=/main/trunk/; revision=14264 --- pym/portage/__init__.py | 17 +---------------- pym/portage/dep.py | 1 - 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index adf306963..77288f7c0 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -7994,22 +7994,7 @@ 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: - return None - mylen=len(myslash) - if mylen==2: - return myslash[0]+"/"+mysplit[0] - elif mylen==1: - return mysplit[0] - else: - return mysplit + return dep.dep_getkey('=' + mycpv) def key_expand(mykey, mydb=None, use_cache=1, settings=None): mysplit=mykey.split("/") diff --git a/pym/portage/dep.py b/pym/portage/dep.py index ae6d43ab5..b54c528fa 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -892,7 +892,6 @@ _use = r'(\[.*\])?' _op = r'([=~]|[><]=?)' _cp = '(' + _cat + '/' + _pkg + '(-' + _version + ')?)' _cpv = '(' + _cp + '-' + _version + ')' -_cpv_re = re.compile(_cpv) _atom_re = re.compile('^(?:' + '(?P' + _op + _cpv + ')|' + -- 2.26.2