summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-11 12:45:20 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-11 12:45:20 -0700
commit5aa9e5b5c55c9f1980d0fb4286c6b7787e99d3df (patch)
tree04697d3ed67e2c773abd510b31e0b81840986ac4
parentfcee99f30fccf3897e764ae41700efc77d7f3745 (diff)
downloadportage-5aa9e5b5c55c9f1980d0fb4286c6b7787e99d3df.tar.gz
portage-5aa9e5b5c55c9f1980d0fb4286c6b7787e99d3df.tar.bz2
portage-5aa9e5b5c55c9f1980d0fb4286c6b7787e99d3df.zip
For digestgen(), add a matchnone parameter to use_reduce() that is the
opposite of matchall.
-rw-r--r--pym/portage/dep/__init__.py10
1 files changed, 9 insertions, 1 deletions
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)