diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-09-19 08:08:04 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-20 15:11:07 +0100 |
commit | 3a8a0bba9b8bdacb73cbc17e88aa0df888217322 (patch) | |
tree | 465035df3e8cf751a323465f547d20e052e51583 /scripts/lib/recipetool/create_buildsys_python.py | |
parent | 6a5bd99bfc334756752e091445ddf46d6b44aa8d (diff) | |
download | poky-3a8a0bba9b8bdacb73cbc17e88aa0df888217322.tar.gz |
recipetool: create: fix picking up name from local python source tree
Make use of the extravalues dict to send back other variable values from
the python handling plugin, and enable passing back PV and PN. This not
only places variable values in the final recipe a bit more consistently
with other types of source, it also allows the name and version to be
picked up fron a local source tree and not just when the recipe is
fetched from a remote URL that happens to have those in it.
(From OE-Core rev: 3e7029f28c6ea9bb1d283bcdc3fdfee11455af8e)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create_buildsys_python.py')
-rw-r--r-- | scripts/lib/recipetool/create_buildsys_python.py | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py index fb9806d318..354af0cb96 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py | |||
@@ -61,8 +61,6 @@ class PythonRecipeHandler(RecipeHandler): | |||
61 | } | 61 | } |
62 | # PN/PV are already set by recipetool core & desc can be extremely long | 62 | # PN/PV are already set by recipetool core & desc can be extremely long |
63 | excluded_fields = [ | 63 | excluded_fields = [ |
64 | 'Name', | ||
65 | 'Version', | ||
66 | 'Description', | 64 | 'Description', |
67 | ] | 65 | ] |
68 | setup_parse_map = { | 66 | setup_parse_map = { |
@@ -237,7 +235,6 @@ class PythonRecipeHandler(RecipeHandler): | |||
237 | 235 | ||
238 | 236 | ||
239 | # Map PKG-INFO & setup.py fields to bitbake variables | 237 | # Map PKG-INFO & setup.py fields to bitbake variables |
240 | bbinfo = {} | ||
241 | for field, values in info.items(): | 238 | for field, values in info.items(): |
242 | if field in self.excluded_fields: | 239 | if field in self.excluded_fields: |
243 | continue | 240 | continue |
@@ -251,37 +248,8 @@ class PythonRecipeHandler(RecipeHandler): | |||
251 | value = ' '.join(str(v) for v in values if v) | 248 | value = ' '.join(str(v) for v in values if v) |
252 | 249 | ||
253 | bbvar = self.bbvar_map[field] | 250 | bbvar = self.bbvar_map[field] |
254 | if bbvar not in bbinfo and value: | 251 | if bbvar not in extravalues and value: |
255 | bbinfo[bbvar] = value | 252 | extravalues[bbvar] = value |
256 | |||
257 | comment_lic_line = None | ||
258 | for pos, line in enumerate(list(lines_before)): | ||
259 | if line.startswith('#') and 'LICENSE' in line: | ||
260 | comment_lic_line = pos | ||
261 | elif line.startswith('LICENSE =') and 'LICENSE' in bbinfo: | ||
262 | if line in ('LICENSE = "Unknown"', 'LICENSE = "CLOSED"'): | ||
263 | lines_before[pos] = 'LICENSE = "{}"'.format(bbinfo['LICENSE']) | ||
264 | if line == 'LICENSE = "CLOSED"' and comment_lic_line: | ||
265 | lines_before[comment_lic_line:pos] = [ | ||
266 | '# WARNING: the following LICENSE value is a best guess - it is your', | ||
267 | '# responsibility to verify that the value is complete and correct.' | ||
268 | ] | ||
269 | del bbinfo['LICENSE'] | ||
270 | |||
271 | src_uri_line = None | ||
272 | for pos, line in enumerate(lines_before): | ||
273 | if line.startswith('SRC_URI ='): | ||
274 | src_uri_line = pos | ||
275 | |||
276 | if bbinfo: | ||
277 | mdinfo = [''] | ||
278 | for k in sorted(bbinfo): | ||
279 | v = bbinfo[k] | ||
280 | mdinfo.append('{} = "{}"'.format(k, v)) | ||
281 | if src_uri_line: | ||
282 | lines_before[src_uri_line-1:src_uri_line-1] = mdinfo | ||
283 | else: | ||
284 | lines_before.extend(mdinfo) | ||
285 | 253 | ||
286 | mapped_deps, unmapped_deps = self.scan_setup_python_deps(srctree, setup_info, setup_non_literals) | 254 | mapped_deps, unmapped_deps = self.scan_setup_python_deps(srctree, setup_info, setup_non_literals) |
287 | 255 | ||