diff options
author | Brian Harring <ferringb@gentoo.org> | 2006-01-06 07:01:11 +0000 |
---|---|---|
committer | Brian Harring <ferringb@gentoo.org> | 2006-01-06 07:01:11 +0000 |
commit | 898c54c5e4f2d89d5ca10bab8841f0b55304bd11 (patch) | |
tree | da6f44e9458783b9d2fa0cb5d6fae5f0e8c6a19c | |
parent | 3e023505c9f335ba997ee043711f1881e916afab (diff) | |
download | portage-2.0.54.tar.gz portage-2.0.54.tar.bz2 portage-2.0.54.zip |
fix USE="-blah" || ( nodea ( blah? ( nodeb ) )" parsing, merge from trunk.v2.0.54
svn path=/main/tags/2.0.54/; revision=2541
-rw-r--r-- | pym/portage.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 1e6dadbea..1d50c5e61 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3818,6 +3818,26 @@ def dep_check(depstring,mydbapi,mysettings,use="yes",mode=None,myuse=None,use_ca #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==[]: |