From: Zac Medico Date: Wed, 8 Jun 2011 17:24:23 +0000 (-0700) Subject: extract_affecting_use: _get_useflag_re(eapi) X-Git-Tag: v2.2.0_alpha39~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=706dd18b2a2936b0fe6a3bed7e1932eef54f0bd1;p=portage.git extract_affecting_use: _get_useflag_re(eapi) This is needed for EAPI="4-python" added in commit 586760f37fb9784327d8447182d49810662f4427. --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 39179a455..b024b88e9 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2618,7 +2618,8 @@ class depgraph(object): for dep_str in "DEPEND", "RDEPEND", "PDEPEND": try: affecting_use.update(extract_affecting_use( - node.metadata[dep_str], target_atom)) + node.metadata[dep_str], target_atom, + eapi=node.metadata["EAPI"])) except InvalidDependString: if not node.installed: raise @@ -2662,7 +2663,8 @@ class depgraph(object): affecting_use = set() for dep_str in dep_strings: - affecting_use.update(extract_affecting_use(dep_str, atom)) + affecting_use.update(extract_affecting_use(dep_str, atom, + eapi=node.metadata["EAPI"])) #Don't show flags as 'affecting' if the user can't change them, affecting_use.difference_update(node.use.mask, \ diff --git a/pym/_emerge/resolver/circular_dependency.py b/pym/_emerge/resolver/circular_dependency.py index e89fd51ed..08dd5c55f 100644 --- a/pym/_emerge/resolver/circular_dependency.py +++ b/pym/_emerge/resolver/circular_dependency.py @@ -112,7 +112,8 @@ class circular_dependency_handler(object): parent_atom = atom.unevaluated_atom break - affecting_use = extract_affecting_use(dep, parent_atom) + affecting_use = extract_affecting_use(dep, parent_atom, + eapi=parent.metadata["EAPI"]) # Make sure we don't want to change a flag that is # a) in use.mask or use.force diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 9dfb12538..8332a05e4 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -2291,7 +2291,7 @@ def check_required_use(required_use, use, iuse_match): tree._satisfied = False not in stack[0] return tree -def extract_affecting_use(mystr, atom): +def extract_affecting_use(mystr, atom, eapi=None): """ Take a dep string and an atom and return the use flags that decide if the given atom is in effect. @@ -2308,7 +2308,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) + useflag_re = _get_useflag_re(eapi) mysplit = mystr.split() level = 0 stack = [[]] diff --git a/pym/portage/tests/dep/testExtractAffectingUSE.py b/pym/portage/tests/dep/testExtractAffectingUSE.py index 029cc6ee9..026a55274 100644 --- a/pym/portage/tests/dep/testExtractAffectingUSE.py +++ b/pym/portage/tests/dep/testExtractAffectingUSE.py @@ -63,7 +63,7 @@ class TestExtractAffectingUSE(TestCase): for dep, atom, expected in test_cases: expected = set(expected) - result = extract_affecting_use(dep, atom) + result = extract_affecting_use(dep, atom, eapi="0") fail_msg = "dep: " + dep + ", atom: " + atom + ", got: " + \ " ".join(sorted(result)) + ", expected: " + " ".join(sorted(expected)) self.assertEqual(result, expected, fail_msg) @@ -72,4 +72,4 @@ class TestExtractAffectingUSE(TestCase): fail_msg = "dep: " + dep + ", atom: " + atom + ", got: " + \ " ".join(sorted(result)) + ", expected: " + " ".join(sorted(expected)) self.assertRaisesMsg(fail_msg, \ - InvalidDependString, extract_affecting_use, dep, atom) + InvalidDependString, extract_affecting_use, dep, atom, eapi="0")