Fix paren_reduce() so that it appropriately raises an InvalidDependString()
authorZac Medico <zmedico@gentoo.org>
Sat, 24 May 2008 21:33:12 +0000 (21:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 24 May 2008 21:33:12 +0000 (21:33 -0000)
in some cases, instead of a nonsense ValueError.

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

pym/portage/dep.py

index 5f858849b980b48c4810bc67e26c3d9e7eba64dd..fa87a7719d1c8462f22a5c47adc53e883b8aa9d6 100644 (file)
@@ -108,7 +108,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: