summaryrefslogtreecommitdiff
path: root/portato/backend/flags.py
diff options
context:
space:
mode:
authorNecoro <>2008-01-11 17:02:28 +0000
committerNecoro <>2008-01-11 17:02:28 +0000
commit933b7e68f19d6107bff06b29fbbce7f364fba74a (patch)
tree15b4052f870cf0814791debb1394d5bc2b07c781 /portato/backend/flags.py
parent8be4bf021300b29e71a9d7a8dee4c41803581656 (diff)
downloadportato-933b7e68f19d6107bff06b29fbbce7f364fba74a.tar.gz
portato-933b7e68f19d6107bff06b29fbbce7f364fba74a.tar.bz2
portato-933b7e68f19d6107bff06b29fbbce7f364fba74a.zip
r598@Devoty: necoro | 2008-01-10 16:36:29 +0100
Handle the new useflag format correctly
Diffstat (limited to '')
-rw-r--r--portato/backend/flags.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index a623973..f171356 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -192,6 +192,27 @@ def invert_use_flag (flag):
else:
return "-"+flag
+def sort_use_flag_list (flaglist):
+ """
+ Sorts a list of useflags. If a use flag starts with "+" or "-" this one is ignored for the matter of sorting.
+ This functions sorts the list itself - thus does not create a new one. But for convenience it returns the list too.
+
+ @param flaglist: the list of useflags
+ @type flaglist: string[]
+
+ @returns: the sorted list (Note: it is the same as the one passed in)
+ @rtype: string[]
+ """
+
+ def flag_key (flag):
+ if flag.startswith(("+","-")):
+ return flag[1:]
+ else:
+ return flag
+
+ flaglist.sort(key = flag_key)
+ return flaglist
+
def set_use_flag (pkg, flag):
"""Sets the useflag for a given package.