summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorMaciej Pijanowski <maciej.pijanowski@3mdeb.com>2019-06-08 21:13:03 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-10 17:38:10 +0100
commitbb59bcd016bdd815809ac10df45d61c364c46df0 (patch)
tree890829945e4524c11d0e296b140efc98da3504bc /scripts/lib
parent0e4c79a7c4dae93fb1b12e8c0a59e8252e3f4b71 (diff)
downloadpoky-bb59bcd016bdd815809ac10df45d61c364c46df0.tar.gz
recipetool: add python3 support
Add support for generating python3 recipes using the recipetool / devtool. Drop python2 support at the same time. Tested with: oe-selftest -r recipetool.RecipetoolTest [YOCTO #13264] (From OE-Core rev: d8b2f58974482b3b1ccc65c5f93104d0d7ba87bc) Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/recipetool/create_buildsys_python.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index 1a38bd0b14..ac9bc9237c 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -31,11 +31,11 @@ def tinfoil_init(instance):
31 31
32 32
33class PythonRecipeHandler(RecipeHandler): 33class PythonRecipeHandler(RecipeHandler):
34 base_pkgdeps = ['python-core'] 34 base_pkgdeps = ['python3-core']
35 excluded_pkgdeps = ['python-dbg'] 35 excluded_pkgdeps = ['python3-dbg']
36 # os.path is provided by python-core 36 # os.path is provided by python3-core
37 assume_provided = ['builtins', 'os.path'] 37 assume_provided = ['builtins', 'os.path']
38 # Assumes that the host python builtin_module_names is sane for target too 38 # Assumes that the host python3 builtin_module_names is sane for target too
39 assume_provided = assume_provided + list(sys.builtin_module_names) 39 assume_provided = assume_provided + list(sys.builtin_module_names)
40 40
41 bbvar_map = { 41 bbvar_map = {
@@ -215,9 +215,9 @@ class PythonRecipeHandler(RecipeHandler):
215 self.apply_info_replacements(info) 215 self.apply_info_replacements(info)
216 216
217 if uses_setuptools: 217 if uses_setuptools:
218 classes.append('setuptools') 218 classes.append('setuptools3')
219 else: 219 else:
220 classes.append('distutils') 220 classes.append('distutils3')
221 221
222 if license_str: 222 if license_str:
223 for i, line in enumerate(lines_before): 223 for i, line in enumerate(lines_before):
@@ -282,7 +282,7 @@ class PythonRecipeHandler(RecipeHandler):
282 for feature, feature_reqs in extras_req.items(): 282 for feature, feature_reqs in extras_req.items():
283 unmapped_deps.difference_update(feature_reqs) 283 unmapped_deps.difference_update(feature_reqs)
284 284
285 feature_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(feature_reqs)) 285 feature_req_deps = ('python3-' + r.replace('.', '-').lower() for r in sorted(feature_reqs))
286 lines_after.append('PACKAGECONFIG[{}] = ",,,{}"'.format(feature.lower(), ' '.join(feature_req_deps))) 286 lines_after.append('PACKAGECONFIG[{}] = ",,,{}"'.format(feature.lower(), ' '.join(feature_req_deps)))
287 287
288 inst_reqs = set() 288 inst_reqs = set()
@@ -293,7 +293,7 @@ class PythonRecipeHandler(RecipeHandler):
293 if inst_reqs: 293 if inst_reqs:
294 unmapped_deps.difference_update(inst_reqs) 294 unmapped_deps.difference_update(inst_reqs)
295 295
296 inst_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(inst_reqs)) 296 inst_req_deps = ('python3-' + r.replace('.', '-').lower() for r in sorted(inst_reqs))
297 lines_after.append('# WARNING: the following rdepends are from setuptools install_requires. These') 297 lines_after.append('# WARNING: the following rdepends are from setuptools install_requires. These')
298 lines_after.append('# upstream names may not correspond exactly to bitbake package names.') 298 lines_after.append('# upstream names may not correspond exactly to bitbake package names.')
299 lines_after.append('RDEPENDS_${{PN}} += "{}"'.format(' '.join(inst_req_deps))) 299 lines_after.append('RDEPENDS_${{PN}} += "{}"'.format(' '.join(inst_req_deps)))
@@ -356,7 +356,7 @@ class PythonRecipeHandler(RecipeHandler):
356 return info, 'setuptools' in imported_modules, non_literals, extensions 356 return info, 'setuptools' in imported_modules, non_literals, extensions
357 357
358 def get_setup_args_info(self, setupscript='./setup.py'): 358 def get_setup_args_info(self, setupscript='./setup.py'):
359 cmd = ['python', setupscript] 359 cmd = ['python3', setupscript]
360 info = {} 360 info = {}
361 keys = set(self.bbvar_map.keys()) 361 keys = set(self.bbvar_map.keys())
362 keys |= set(self.setuparg_list_fields) 362 keys |= set(self.setuparg_list_fields)
@@ -390,7 +390,7 @@ class PythonRecipeHandler(RecipeHandler):
390 def get_setup_byline(self, fields, setupscript='./setup.py'): 390 def get_setup_byline(self, fields, setupscript='./setup.py'):
391 info = {} 391 info = {}
392 392
393 cmd = ['python', setupscript] 393 cmd = ['python3', setupscript]
394 cmd.extend('--' + self.setuparg_map.get(f, f.lower()) for f in fields) 394 cmd.extend('--' + self.setuparg_map.get(f, f.lower()) for f in fields)
395 try: 395 try:
396 info_lines = self.run_command(cmd, cwd=os.path.dirname(setupscript)).splitlines() 396 info_lines = self.run_command(cmd, cwd=os.path.dirname(setupscript)).splitlines()
@@ -527,7 +527,7 @@ class PythonRecipeHandler(RecipeHandler):
527 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR') 527 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
528 528
529 ldata = tinfoil.config_data.createCopy() 529 ldata = tinfoil.config_data.createCopy()
530 bb.parse.handle('classes/python-dir.bbclass', ldata, True) 530 bb.parse.handle('classes/python3-dir.bbclass', ldata, True)
531 python_sitedir = ldata.getVar('PYTHON_SITEPACKAGES_DIR') 531 python_sitedir = ldata.getVar('PYTHON_SITEPACKAGES_DIR')
532 532
533 dynload_dir = os.path.join(os.path.dirname(python_sitedir), 'lib-dynload') 533 dynload_dir = os.path.join(os.path.dirname(python_sitedir), 'lib-dynload')