summaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-08 07:38:37 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-08 07:38:37 +0000
commitb6e0cbe94ac308f532d657f250187edbc0cd8d2c (patch)
treeabdea893dd2af0818f84a3bb69f595cdd8f4b7e8 /pym
parentAdd --newuse back to the suggested options in the depclean warning message, s... (diff)
downloadportage-multirepo-b6e0cbe94ac308f532d657f250187edbc0cd8d2c.tar.gz
portage-multirepo-b6e0cbe94ac308f532d657f250187edbc0cd8d2c.tar.bz2
portage-multirepo-b6e0cbe94ac308f532d657f250187edbc0cd8d2c.zip
Thanks to Chris White for these portage_dep docstrings.
svn path=/main/trunk/; revision=4987
Diffstat (limited to 'pym')
-rw-r--r--pym/portage_dep.py56
1 files changed, 50 insertions, 6 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index 932c3e3c..6c60e34a 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -58,6 +58,14 @@ def paren_reduce(mystr,tokenize=1):
return mylist
def paren_enclose(mylist):
+ """
+ Convert a list to a string with sublists enclosed with parens.
+
+ @param mylist: The list
+ @type mylist: List
+ @rtype: String
+ @return: The paren enclosed string
+ """
mystrparts = []
for x in mylist:
if isinstance(x, list):
@@ -67,8 +75,20 @@ def paren_enclose(mylist):
return " ".join(mystrparts)
def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
- """Takes a paren_reduce'd array and reduces the use? conditionals out
+ """
+ Takes a paren_reduce'd array and reduces the use? conditionals out
leaving an array with subarrays
+
+ @param deparray: paren_reduce'd list of deps
+ @type deparray: List
+ @param uselist: List of use flags
+ @type uselist: List
+ @param masklist: List of masked flags
+ @type masklist: List
+ @param matchall: Resolve all conditional deps unconditionally. Used by repoman
+ @type matchall: Integer
+ @rtype: List
+ @return: The use reduced depend array
"""
# Quick validity checks
for x in range(len(deparray)):
@@ -146,10 +166,23 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
def dep_opconvert(deplist):
- """Move || and && to the beginning of the following arrays"""
- # Hack in management of the weird || for dep_wordreduce, etc.
- # dep_opconvert: [stuff, ["||", list, of, things]]
- # At this point: [stuff, "||", [list, of, things]]
+ """
+ Iterate recursively through a list of deps, if the
+ dep is a '||' or '&&' operator, combine it with the
+ list of deps that follows..
+
+ Example usage:
+ >>> test = ["blah", "||", ["foo", "bar", "baz"]]
+ >>> dep_opconvert(test)
+ ['blah', ['||', 'foo', 'bar', 'baz']]
+
+ @param deplist: A list of deps to format
+ @type mydep: List
+ @rtype: List
+ @return:
+ The new list with the new ordering
+ """
+
retlist = []
x = 0
while x != len(deplist):
@@ -165,7 +198,18 @@ def dep_opconvert(deplist):
def get_operator(mydep):
"""
- returns '~', '=', '>', '<', '=*', '>=', or '<='
+ Return the operator used in a depstring.
+
+ Example usage:
+ >>> from portage_dep import *
+ >>> get_operator(">=test-1.0")
+ '>='
+
+ @param mydep: The dep string to check
+ @type mydep: String
+ @rtype: String
+ @return:
+ The operator. One of: '~', '=', '>', '<', '=*', '>=', or '<='
"""
if mydep[0] == "~":
operator = "~"