summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-08-11 20:35:36 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-15 18:21:52 +0100
commit4132ccad25abd6e1fca9d0b916ad3bb0d854d29f (patch)
tree635f3414c730338d55f33a2f2ada910e8629dc3a /scripts
parentdb8f5d02c08b257f5357701e3550fdf313a053df (diff)
downloadtizen-distro-4132ccad25abd6e1fca9d0b916ad3bb0d854d29f.tar.gz
tizen-distro-4132ccad25abd6e1fca9d0b916ad3bb0d854d29f.tar.bz2
tizen-distro-4132ccad25abd6e1fca9d0b916ad3bb0d854d29f.zip
wic: Add utility function for parsing sourceparams
Parses strings of the form key1=val1[,key2=val2,...] and returns a dict. Also accepts valueless keys i.e. without =. (From OE-Core rev: 36f258ee6e60c26fd44b9bc71c318363cec71f42) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/utils/oe/misc.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 87e30411b0..aa9b23582b 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -179,3 +179,26 @@ def get_bitbake_var(key):
val = get_line_val(line, key)
return val
return None
+
+def parse_sourceparams(sourceparams):
+ """
+ Split sourceparams string of the form key1=val1[,key2=val2,...]
+ into a dict. Also accepts valueless keys i.e. without =.
+
+ Returns dict of param key/val pairs (note that val may be None).
+ """
+ params_dict = {}
+
+ params = sourceparams.split(',')
+ if params:
+ for p in params:
+ if not p:
+ continue
+ if not '=' in p:
+ key = p
+ val = None
+ else:
+ key, val = p.split('=')
+ params_dict[key] = val
+
+ return params_dict