extract_affecting_use: allow parens in atoms
authorZac Medico <zmedico@gentoo.org>
Mon, 11 Apr 2011 22:30:13 +0000 (15:30 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 11 Apr 2011 22:30:13 +0000 (15:30 -0700)
This fixes bug #363073 in which an InvalidDependString exception is
erroneously triggered by atoms containing EAPI 4 USE dependency
defaults. This case is very similar to bug #354003 which was fixed in
commit 8735222b77e66850213e2aa6a7ea48e744ba0d4f.

pym/portage/dep/__init__.py

index a92b481d1e4308e0c958486141e9fdfffb90282c..5911c8cd074c44caa3b4957a016a619c6d626fd8 100644 (file)
@@ -2310,6 +2310,7 @@ def extract_affecting_use(mystr, atom):
        @rtype: Tuple of two lists of strings
        @return: List of use flags that need to be enabled, List of use flag that need to be disabled
        """
+       useflag_re = _get_useflag_re(None)
        mysplit = mystr.split()
        level = 0
        stack = [[]]
@@ -2322,9 +2323,10 @@ def extract_affecting_use(mystr, atom):
                else:
                        flag = conditional[:-1]
 
-               if not flag:
+               if useflag_re.match(flag) is None:
                        raise InvalidDependString(
-                               _("malformed syntax: '%s'") % mystr)
+                               _("invalid use flag '%s' in conditional '%s'") % \
+                               (flag, conditional))
 
                return flag
 
@@ -2397,7 +2399,7 @@ def extract_affecting_use(mystr, atom):
                        need_bracket = True
                        stack[level].append(token)
                else:
-                       if need_bracket or "(" in token or ")" in token or "|" in token:
+                       if need_bracket:
                                raise InvalidDependString(
                                        _("malformed syntax: '%s'") % mystr)