summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-08-12 12:30:20 +0200
committerZac Medico <zmedico@gentoo.org>2010-08-12 03:40:45 -0700
commite341cb822a979baac8ad5a7acb7b4d0f18b8fe27 (patch)
tree62a58bfacd4af0da94d4552ce6cd1d008fa52f25
parent6d0831c89ac150f1df196895f41b39d88265001d (diff)
downloadportage-e341cb822a979baac8ad5a7acb7b4d0f18b8fe27.tar.gz
portage-e341cb822a979baac8ad5a7acb7b4d0f18b8fe27.tar.bz2
portage-e341cb822a979baac8ad5a7acb7b4d0f18b8fe27.zip
portage.dep.extract_affecting_use: Don't raise if atom is not in dep string
-rw-r--r--pym/portage/dep/__init__.py6
-rw-r--r--pym/portage/tests/dep/testExtractAffectingUSE.py8
2 files changed, 4 insertions, 10 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index f15b8a2d9..4c15b787c 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1481,7 +1481,6 @@ def extract_affecting_use(mystr, atom):
stack = [[]]
need_bracket = False
affecting_use = set()
- atom_seen = False
def flag(conditional):
if conditional[0] == "!":
@@ -1549,15 +1548,10 @@ def extract_affecting_use(mystr, atom):
need_bracket = True
stack[level].append(token)
elif token == atom:
- atom_seen = True
stack[level].append(token)
if level != 0 or need_bracket:
raise portage.exception.InvalidDependString(
_("malformed syntax: '%s'") % mystr)
- if not atom_seen:
- raise portage.exception.IncorrectParameter(
- _("extract_affecting_use: atom '%s' not in dep string: '%s'") % (atom, mystr))
-
return affecting_use
diff --git a/pym/portage/tests/dep/testExtractAffectingUSE.py b/pym/portage/tests/dep/testExtractAffectingUSE.py
index ba904b927..79ac9fc73 100644
--- a/pym/portage/tests/dep/testExtractAffectingUSE.py
+++ b/pym/portage/tests/dep/testExtractAffectingUSE.py
@@ -3,7 +3,7 @@
from portage.tests import TestCase
from portage.dep import extract_affecting_use
-from portage.exception import InvalidDependString, IncorrectParameter
+from portage.exception import InvalidDependString
class TestExtractAffectingUSE(TestCase):
@@ -32,6 +32,8 @@ class TestExtractAffectingUSE(TestCase):
("( ab? ( || ( ( A ) || ( b? ( ( ( || ( B ( C ) ) ) ) ) ) ) ) )", "A", ("ab",)),
("( ab? ( || ( ( A ) || ( b? ( ( ( || ( B ( C ) ) ) ) ) ) ) ) )", "B", ("ab", "b")),
("( ab? ( || ( ( A ) || ( b? ( ( ( || ( B ( C ) ) ) ) ) ) ) ) )", "C", ("ab", "b")),
+
+ ("a? ( A )", "B", []),
)
test_cases_xfail = (
@@ -52,8 +54,6 @@ class TestExtractAffectingUSE(TestCase):
("a? A", "A"),
("( || ( || || ( A ) foo? ( B ) ) )", "A"),
("( || ( || bar? ( A ) foo? ( B ) ) )", "A"),
-
- ("a? ( A )", "B"),
)
for dep, atom, expected in test_cases:
@@ -67,4 +67,4 @@ class TestExtractAffectingUSE(TestCase):
fail_msg = "dep: " + dep + ", atom: " + atom + ", got: " + \
" ".join(sorted(result)) + ", expected: " + " ".join(sorted(expected))
self.assertRaisesMsg(fail_msg, \
- (InvalidDependString, IncorrectParameter), extract_affecting_use, dep, atom)
+ InvalidDependString, extract_affecting_use, dep, atom)