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
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, \
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
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.
@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 = [[]]
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)
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")