summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-21 16:57:17 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-21 16:57:17 +0000
commite6809abc78708f7be28f5b18eb3cee4d36929bd2 (patch)
tree5e7c68e9cd996027a13d5a761e96cfd00567ca0d
parentacfd9bd4e4041b98b82e1ac616ed25980a1e11af (diff)
downloadportage-e6809abc78708f7be28f5b18eb3cee4d36929bd2.tar.gz
portage-e6809abc78708f7be28f5b18eb3cee4d36929bd2.tar.bz2
portage-e6809abc78708f7be28f5b18eb3cee4d36929bd2.zip
Fix dep_expand so that it doesn't use deprecated dep_getcpv() usage
(with missing category). svn path=/main/trunk/; revision=14330
-rw-r--r--pym/portage/__init__.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index d1dba8def..a5a16734e 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7892,21 +7892,31 @@ def dep_expand(mydep, mydb=None, use_cache=1, settings=None):
mydep=mydep[1:]
orig_dep = mydep
if isinstance(orig_dep, dep.Atom):
- mydep = orig_dep.cpv
+ mydep = orig_dep.cp
else:
- mydep = dep_getcpv(orig_dep)
- myindex = orig_dep.index(mydep)
- prefix = orig_dep[:myindex]
- postfix = orig_dep[myindex+len(mydep):]
+ mydep = orig_dep
+ has_cat = '/' in orig_dep
+ if not has_cat:
+ alphanum = re.search(r'\w', orig_dep)
+ if alphanum:
+ mydep = orig_dep[:alphanum.start()] + "null/" + \
+ orig_dep[alphanum.start():]
+ try:
+ mydep = dep.Atom(mydep)
+ except exception.InvalidAtom:
+ # Missing '=' prefix is allowed for backward compatibility.
+ if not dep.isvalidatom("=" + mydep):
+ raise
+ mydep = dep.Atom('=' + mydep)
+ orig_dep = '=' + orig_dep
+ if not has_cat:
+ null_cat, pn = catsplit(mydep.cp)
+ mydep = pn
+ else:
+ mydep = mydep.cp
expanded = cpv_expand(mydep, mydb=mydb,
use_cache=use_cache, settings=settings)
- try:
- return portage.dep.Atom(prefix + expanded + postfix)
- except portage.exception.InvalidAtom:
- # Missing '=' prefix is allowed for backward compatibility.
- if not isvalidatom("=" + prefix + expanded + postfix):
- raise
- return portage.dep.Atom("=" + prefix + expanded + postfix)
+ return portage.dep.Atom(orig_dep.replace(mydep, expanded, 1))
def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
use_cache=1, use_binaries=0, myroot="/", trees=None):