From e341cb822a979baac8ad5a7acb7b4d0f18b8fe27 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Thu, 12 Aug 2010 12:30:20 +0200 Subject: portage.dep.extract_affecting_use: Don't raise if atom is not in dep string --- pym/portage/dep/__init__.py | 6 ------ pym/portage/tests/dep/testExtractAffectingUSE.py | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'pym') 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) -- cgit v1.2.3-1-g7c22