Fix use_reduce() so that it appropriately raises an InvalidDependString
authorZac Medico <zmedico@gentoo.org>
Sun, 25 May 2008 04:19:38 +0000 (04:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 25 May 2008 04:19:38 +0000 (04:19 -0000)
instead of an IndexError in some cases (avoid IndexError by using slice
notation). (trunk r10391)

svn path=/main/branches/2.1.2/; revision=10407

pym/portage_dep.py

index 26737d6187c783c9e7b4dadb979cb784e5aefcea..4fb6ddde9c5a681c1012d71dba0524995566d59c 100644 (file)
@@ -175,7 +175,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] == "?":