diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/utils/oe/misc.py | 27 |
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] |