mirror of
https://git.yoctoproject.org/poky
synced 2026-09-13 18:49:33 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
6a5bd99bfc
commit
3a8a0bba9b
@@ -61,8 +61,6 @@ class PythonRecipeHandler(RecipeHandler):
|
|||||||
}
|
}
|
||||||
# PN/PV are already set by recipetool core & desc can be extremely long
|
# PN/PV are already set by recipetool core & desc can be extremely long
|
||||||
excluded_fields = [
|
excluded_fields = [
|
||||||
'Name',
|
|
||||||
'Version',
|
|
||||||
'Description',
|
'Description',
|
||||||
]
|
]
|
||||||
setup_parse_map = {
|
setup_parse_map = {
|
||||||
@@ -237,7 +235,6 @@ class PythonRecipeHandler(RecipeHandler):
|
|||||||
|
|
||||||
|
|
||||||
# Map PKG-INFO & setup.py fields to bitbake variables
|
# Map PKG-INFO & setup.py fields to bitbake variables
|
||||||
bbinfo = {}
|
|
||||||
for field, values in info.items():
|
for field, values in info.items():
|
||||||
if field in self.excluded_fields:
|
if field in self.excluded_fields:
|
||||||
continue
|
continue
|
||||||
@@ -251,37 +248,8 @@ class PythonRecipeHandler(RecipeHandler):
|
|||||||
value = ' '.join(str(v) for v in values if v)
|
value = ' '.join(str(v) for v in values if v)
|
||||||
|
|
||||||
bbvar = self.bbvar_map[field]
|
bbvar = self.bbvar_map[field]
|
||||||
if bbvar not in bbinfo and value:
|
if bbvar not in extravalues and value:
|
||||||
bbinfo[bbvar] = value
|
extravalues[bbvar] = value
|
||||||
|
|
||||||
comment_lic_line = None
|
|
||||||
for pos, line in enumerate(list(lines_before)):
|
|
||||||
if line.startswith('#') and 'LICENSE' in line:
|
|
||||||
comment_lic_line = pos
|
|
||||||
elif line.startswith('LICENSE =') and 'LICENSE' in bbinfo:
|
|
||||||
if line in ('LICENSE = "Unknown"', 'LICENSE = "CLOSED"'):
|
|
||||||
lines_before[pos] = 'LICENSE = "{}"'.format(bbinfo['LICENSE'])
|
|
||||||
if line == 'LICENSE = "CLOSED"' and comment_lic_line:
|
|
||||||
lines_before[comment_lic_line:pos] = [
|
|
||||||
'# WARNING: the following LICENSE value is a best guess - it is your',
|
|
||||||
'# responsibility to verify that the value is complete and correct.'
|
|
||||||
]
|
|
||||||
del bbinfo['LICENSE']
|
|
||||||
|
|
||||||
src_uri_line = None
|
|
||||||
for pos, line in enumerate(lines_before):
|
|
||||||
if line.startswith('SRC_URI ='):
|
|
||||||
src_uri_line = pos
|
|
||||||
|
|
||||||
if bbinfo:
|
|
||||||
mdinfo = ['']
|
|
||||||
for k in sorted(bbinfo):
|
|
||||||
v = bbinfo[k]
|
|
||||||
mdinfo.append('{} = "{}"'.format(k, v))
|
|
||||||
if src_uri_line:
|
|
||||||
lines_before[src_uri_line-1:src_uri_line-1] = mdinfo
|
|
||||||
else:
|
|
||||||
lines_before.extend(mdinfo)
|
|
||||||
|
|
||||||
mapped_deps, unmapped_deps = self.scan_setup_python_deps(srctree, setup_info, setup_non_literals)
|
mapped_deps, unmapped_deps = self.scan_setup_python_deps(srctree, setup_info, setup_non_literals)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user