summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils/oe
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
commitef700ea11f51f239a886831ad26ff0d64b57c73d (patch)
tree8757587ff8309ef628809abd08fdc26838702bc2 /scripts/lib/wic/utils/oe
parent3c90ee9bc242a623cc0a09de59e7d20ac5bd061a (diff)
downloadpoky-ef700ea11f51f239a886831ad26ff0d64b57c73d.tar.gz
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/lib/wic/utils/oe')
-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):
179 val = get_line_val(line, key) 179 val = get_line_val(line, key)
180 return val 180 return val
181 return None 181 return None
182
183def parse_sourceparams(sourceparams):
184 """
185 Split sourceparams string of the form key1=val1[,key2=val2,...]
186 into a dict. Also accepts valueless keys i.e. without =.
187
188 Returns dict of param key/val pairs (note that val may be None).
189 """
190 params_dict = {}
191
192 params = sourceparams.split(',')
193 if params:
194 for p in params:
195 if not p:
196 continue
197 if not '=' in p:
198 key = p
199 val = None
200 else:
201 key, val = p.split('=')
202 params_dict[key] = val
203
204 return params_dict