Fix use_reduce() so that it appropriately raises an InvalidDependString
authorZac Medico <zmedico@gentoo.org>
Sat, 24 May 2008 21:00:07 +0000 (21:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 24 May 2008 21:00:07 +0000 (21:00 -0000)
instead of an IndexError in some cases (avoid IndexError by using slice
notation).

svn path=/main/trunk/; revision=10391

pym/portage/dep.py

index 267b356fbaf08e864cbd008cc85e93d2e4878758..998abfee71afeb882732077c34d8f46fbb25b8f3 100644 (file)
@@ -230,7 +230,7 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
                                rlist.append([])
 
                else:
-                       if head[-1] == "?": # Use reduce next group on fail.
+                       if head[-1:] == "?": # Use reduce next group on fail.
                                # Pull any other use conditions and the following atom or list into a separate array
                                newdeparray = [head]
                                while isinstance(newdeparray[-1], str) and newdeparray[-1][-1] == "?":