Skip to contentSkip to conversation

utils: remove exec_flat_python_func()

PATCH New Ross Burton 1 participant 1 message Nov 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils: remove exec_flat_python_func()

Nothing in bitbake has ever used this, and the last callers of this were removed from oe-core in 2016[1].

[1] oe-core 2724511e188 ("classes/patch: move several functions to oe.patch")

---
 lib/bb/utils.py | 25 -------------------------
 1 file changed, 25 deletions(-)
lib/bb/utils.py +0 -25
index ec6eb2181a..1b0ff886a3 100644
@@ -1525,31 +1525,6 @@ def process_profilelog(fn, fn_out = None):
         p.print_callers()
 
 
-def exec_flat_python_func(func, *args, **kwargs):
-    """Execute a flat python function (defined with ``def funcname(args): ...``)
-
-    Returns the return value of the function."""
-    # Prepare a small piece of python code which calls the requested function
-    # To do this we need to prepare two things - a set of variables we can use to pass
-    # the values of arguments into the calling function, and the list of arguments for
-    # the function being called
-    context = {}
-    funcargs = []
-    # Handle unnamed arguments
-    aidx = 1
-    for arg in args:
-        argname = 'arg_%s' % aidx
-        context[argname] = arg
-        funcargs.append(argname)
-        aidx += 1
-    # Handle keyword arguments
-    context.update(kwargs)
-    funcargs.extend(['%s=%s' % (arg, arg) for arg in kwargs.keys()])
-    code = 'retval = %s(%s)' % (func, ', '.join(funcargs))
-    comp = bb.utils.better_compile(code, '<string>', '<string>')
-    bb.utils.better_exec(comp, context, code, '<string>')
-    return context['retval']
-
 def edit_metadata(meta_lines, variables, varfunc, match_overrides=False):
     """Edit lines from a recipe or config file and modify one or more
     specified variable values set in the file using a specified callback
Signature · 1 line
2.43.0