extract_affecting_use: _get_useflag_re(eapi)
authorZac Medico <zmedico@gentoo.org>
Wed, 8 Jun 2011 17:24:23 +0000 (10:24 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 8 Jun 2011 17:24:23 +0000 (10:24 -0700)
This is needed for EAPI="4-python" added in commit
586760f37fb9784327d8447182d49810662f4427.

pym/_emerge/depgraph.py
pym/_emerge/resolver/circular_dependency.py
pym/portage/dep/__init__.py
pym/portage/tests/dep/testExtractAffectingUSE.py

index 39179a4555aa4a6440ab6349b966ff94268fe047..b024b88e96ddaf9f713db271a40b8cf7a088d921 100644 (file)
@@ -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, \
index e89fd51ed9ccd5cf7bd08d3d8069b20d97cd8239..08dd5c55fcc302515aa8731bd25ad06bd60e2e8a 100644 (file)
@@ -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
index 9dfb12538eb4e1a8694c30e48668d71341aaadd4..8332a05e4edd7d8584bc5cdd10e1d36fb20e0028 100644 (file)
@@ -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 = [[]]
index 029cc6ee95d8b6fe0a096203907a761d8ee67957..026a5527432392c98e8f93b4dd32ec40d2c3ca99 100644 (file)
@@ -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")