#if mysplit==None, then we have a parse error (paren mismatch or misplaced ||)
#up until here, we haven't needed to look at the database tree
- # recursive cleansing of empty arrays.
- # without this, portage eats itself if fed a || ()
- def f(a):
- x = 0
- l = len(a)
- while x < l:
- if isinstance(a[x], list):
- l2 = len(a[x])
- if l2 == 0:
- a.pop(x)
- elif l2 == 1 and a[x][0] in ("||", "&&"):
- a.pop(x)
- else:
- f(a[x])
- x+=1
- continue
- l-=1
- x+=1
- f(mysplit)
-
if mysplit==None:
return [0,"Parse Error (parentheses mismatch?)"]
elif mysplit==[]:
head = mydeparray.pop(0)
if type(head) == types.ListType:
- rlist.append(use_reduce(head, uselist, masklist, matchall, excludeall))
+ additions = use_reduce(head, uselist, masklist, matchall, excludeall)
+ if additions:
+ rlist.append(additions)
+ elif rlist and rlist[-1] in ("||","&&"):
+ raise portage_exception.InvalidDependString("INVALID "+rlist[-1]+" DEPEND STRING: "+str(deparray))
else:
if head[-1] == "?": # Use reduce next group on fail.
if ismatch:
target = newdeparray[-1]
if isinstance(target, list):
- rlist.append(use_reduce(target, uselist, masklist, matchall, excludeall))
+ additions = use_reduce(target, uselist, masklist, matchall, excludeall)
+ if additions:
+ rlist.append(additions)
else:
rlist += [target]