Fix paren_reduce() so that it appropriately raises an InvalidDependString()
authorZac Medico <zmedico@gentoo.org>
Sun, 25 May 2008 04:23:16 +0000 (04:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 25 May 2008 04:23:16 +0000 (04:23 -0000)
in some cases, instead of a nonsense ValueError. (trunk r10393)

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

pym/portage_dep.py

index 9ad8421c9bae36157c28c438c452937337231138..41c2c54ff8754e15072ae6774d04514efe035689 100644 (file)
@@ -89,7 +89,11 @@ def paren_reduce(mystr,tokenize=1):
                                "missing right parenthesis: '%s'" % mystr)
                elif has_left_paren and left_paren < right_paren:
                        freesec,subsec = mystr.split("(",1)
-                       subsec,tail = paren_reduce(subsec,tokenize)
+                       sublist = paren_reduce(subsec, tokenize=tokenize)
+                       if len(sublist) != 2:
+                               raise portage_exception.InvalidDependString(
+                                       "malformed syntax: '%s'" % mystr)
+                       subsec, tail = sublist
                else:
                        subsec,tail = mystr.split(")",1)
                        if tokenize: