summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-30 20:47:01 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-30 21:38:21 +0100
commite1fe3479a603d3dc95d7ac78da4bc58b78a1706c (patch)
treea82379f5cdbb825bbaa50869d4c331df5833d461 /scripts/lib/wic
parent58c393022f624213f686a716d87cca60a289e08e (diff)
downloadpoky-e1fe3479a603d3dc95d7ac78da4bc58b78a1706c.tar.gz
wic: create new method _parse_line
Moved code that parses one line of 'bitbake -e' output to separate method _parse_line. This method will be also used later to parse lines of .env files. (From OE-Core rev: 49ef04d3c9eeb76cbbc89b27b4dd1570b7a2552b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/utils/oe/misc.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 3537a2e711..41e435fc27 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -131,6 +131,22 @@ class BitbakeVars(defaultdict):
131 def __init__(self): 131 def __init__(self):
132 defaultdict.__init__(self, dict) 132 defaultdict.__init__(self, dict)
133 133
134 def _parse_line(self, line, image):
135 """
136 Parse one line from bitbake -e output.
137 Put result key-value pair into the storage.
138 """
139 if "=" not in line:
140 return
141 try:
142 key, val = line.split("=")
143 except ValueError:
144 return
145 key = key.strip()
146 val = val.strip()
147 if key.replace('_', '').isalnum():
148 self[image][key] = val.strip('"')
149
134 def get_var(self, var, image=None): 150 def get_var(self, var, image=None):
135 """ 151 """
136 Get bitbake variable value lazy way, i.e. run 152 Get bitbake variable value lazy way, i.e. run
@@ -154,16 +170,7 @@ class BitbakeVars(defaultdict):
154 170
155 # Parse bitbake -e output 171 # Parse bitbake -e output
156 for line in lines.split('\n'): 172 for line in lines.split('\n'):
157 if "=" not in line: 173 self._parse_line(line, image)
158 continue
159 try:
160 key, val = line.split("=")
161 except ValueError:
162 continue
163 key = key.strip()
164 val = val.strip()
165 if key.replace('_', '').isalnum():
166 self[image][key] = val.strip('"')
167 174
168 # Make first image a default set of variables 175 # Make first image a default set of variables
169 images = [key for key in self if key] 176 images = [key for key in self if key]