summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/build.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 85ad8ea689..e2f91fa3b7 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -356,6 +356,27 @@ def create_progress_handler(func, progress, logfile, d):
356 elif progress.startswith('outof:'): 356 elif progress.startswith('outof:'):
357 # Use specified regex 357 # Use specified regex
358 return bb.progress.OutOfProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) 358 return bb.progress.OutOfProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile)
359 elif progress.startswith("custom:"):
360 # Use a custom progress handler that was injected via OE_EXTRA_IMPORTS or __builtins__
361 import functools
362 from types import ModuleType
363
364 parts = progress.split(":", 2)
365 _, cls, otherargs = parts[0], parts[1], (parts[2] or None) if parts[2:] else None
366 if cls:
367 def resolve(x, y):
368 if not x:
369 return None
370 if isinstance(x, ModuleType):
371 return getattr(x, y, None)
372 return x.get(y)
373 cls_obj = functools.reduce(resolve, cls.split("."), bb.utils._context)
374 if not cls_obj:
375 # Fall-back on __builtins__
376 cls_obj = functools.reduce(lambda x, y: x.get(y), cls.split("."), __builtins__)
377 if cls_obj:
378 return cls_obj(d, outfile=logfile, otherargs=otherargs)
379 bb.warn('%s: unknown custom progress handler in task progress varflag value "%s", ignoring' % (func, cls))
359 else: 380 else:
360 bb.warn('%s: invalid task progress varflag value "%s", ignoring' % (func, progress)) 381 bb.warn('%s: invalid task progress varflag value "%s", ignoring' % (func, progress))
361 382