recipetool/create_buildsys_python: prefix created recipes with python3-

By convention, all python recipes start with "python3-" so update
create_buildsys_python to do this

This rule doesn't apply for packages already starting with "python"

Update recipetool's selftest accordingly

(From OE-Core rev: b0d87440e610b80f763d09784d4a90a148bb3e7b)

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Julien Stephan 2023-10-25 17:46:56 +02:00 committed by Richard Purdie
parent 0021e3573a
commit be129bd0bc
2 changed files with 7 additions and 2 deletions

View File

@ -445,7 +445,7 @@ class RecipetoolCreateTests(RecipetoolBase):
# Basic test to see if github URL mangling works # Basic test to see if github URL mangling works
temprecipe = os.path.join(self.tempdir, 'recipe') temprecipe = os.path.join(self.tempdir, 'recipe')
os.makedirs(temprecipe) os.makedirs(temprecipe)
recipefile = os.path.join(temprecipe, 'meson_git.bb') recipefile = os.path.join(temprecipe, 'python3-meson_git.bb')
srcuri = 'https://github.com/mesonbuild/meson;rev=0.32.0' srcuri = 'https://github.com/mesonbuild/meson;rev=0.32.0'
result = runCmd(['recipetool', 'create', '-o', temprecipe, srcuri]) result = runCmd(['recipetool', 'create', '-o', temprecipe, srcuri])
self.assertTrue(os.path.isfile(recipefile)) self.assertTrue(os.path.isfile(recipefile))
@ -479,7 +479,7 @@ class RecipetoolCreateTests(RecipetoolBase):
temprecipe = os.path.join(self.tempdir, 'recipe') temprecipe = os.path.join(self.tempdir, 'recipe')
os.makedirs(temprecipe) os.makedirs(temprecipe)
pv = '0.32.0' pv = '0.32.0'
recipefile = os.path.join(temprecipe, 'meson_%s.bb' % pv) recipefile = os.path.join(temprecipe, 'python3-meson_%s.bb' % pv)
srcuri = 'https://github.com/mesonbuild/meson/releases/download/%s/meson-%s.tar.gz' % (pv, pv) srcuri = 'https://github.com/mesonbuild/meson/releases/download/%s/meson-%s.tar.gz' % (pv, pv)
result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
self.assertTrue(os.path.isfile(recipefile)) self.assertTrue(os.path.isfile(recipefile))

View File

@ -297,6 +297,11 @@ 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 == "PN":
# by convention python recipes start with "python3-"
if not value.startswith('python'):
value = 'python3-' + value
if bbvar not in extravalues and value: if bbvar not in extravalues and value:
extravalues[bbvar] = value extravalues[bbvar] = value