From 5aa9e5b5c55c9f1980d0fb4286c6b7787e99d3df Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 11 Sep 2010 12:45:20 -0700 Subject: For digestgen(), add a matchnone parameter to use_reduce() that is the opposite of matchall. --- pym/portage/dep/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 7475d8592..b1d08e267 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -254,7 +254,7 @@ def paren_enclose(mylist): return " ".join(mystrparts) def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], is_src_uri=False, \ - eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None): + eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False): """ Takes a dep string and reduces the use? conditionals out, leaving an array with subarrays. All redundant brackets are removed. @@ -281,6 +281,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i @type is_valid_flag: Function @param token_class: Convert all non operator tokens into this class @type token_class: Class + @param matchnone: Treat all conditionals as inactive. Used by digestgen(). + @type matchnone: Bool @rtype: List @return: The use reduced depend array """ @@ -294,6 +296,9 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i if opconvert and flat: raise ValueError("portage.dep.use_reduce: 'opconvert' and 'flat' are mutually exclusive") + if matchall and matchnone: + raise ValueError("portage.dep.use_reduce: 'matchall' and 'matchnone' are mutually exclusive") + def is_active(conditional): """ Decides if a given use conditional is active. @@ -326,6 +331,9 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i if matchall: return True + if matchnone: + return False + return (flag in uselist and not is_negated) or \ (flag not in uselist and is_negated) -- cgit v1.2.3-1-g7c22