From ca57018f8dd8d65f2df5c5df636c2cd7db8445d9 Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gentoo.org>
Date: Mon, 7 Feb 2011 13:59:23 -0800
Subject: [PATCH] paren_reduce: allow parens in atoms, for EAPI 4

This will fix bug #354003.
---
 pym/portage/dep/__init__.py                | 2 +-
 pym/portage/tests/dep/test_paren_reduce.py | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index cf83e0a0a..a8d05f1f7 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -178,7 +178,7 @@ def paren_reduce(mystr):
 			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)
 
diff --git a/pym/portage/tests/dep/test_paren_reduce.py b/pym/portage/tests/dep/test_paren_reduce.py
index 6aac955c5..a7bbf974b 100644
--- a/pym/portage/tests/dep/test_paren_reduce.py
+++ b/pym/portage/tests/dep/test_paren_reduce.py
@@ -30,6 +30,8 @@ class TestParenReduce(TestCase):
 
 			( "|| ( ( A B ) C )", [ "||", [ ["A", "B"], "C"] ]),
 			( "|| ( ( A B ) ( C ) )", [ "||", [ ["A", "B"], "C"] ]),
+			# test USE dep defaults for bug #354003
+			( ">=dev-lang/php-5.2[pcre(+)]", [ ">=dev-lang/php-5.2[pcre(+)]" ]),
 		)
 		
 		test_cases_xfail = (
-- 
2.26.2