Skip to contentSkip to conversation

bb: Use namedtuple for Task data

PATCH New Joshua Watt 1 participant 1 message May 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bb: Use namedtuple for Task data

Task dependency data is becoming unwieldy with the number of indices it contains. Convert it to use a named tuple instead, which allows members to be indexed by a named property or an index (which allows it to retain backward compatibility).

---
 bitbake/lib/bb/__init__.py | 12 ++++++++++
 bitbake/lib/bb/runqueue.py | 45 +++++++++++++++++++++++---------------
 2 files changed, 39 insertions(+), 18 deletions(-)
bitbake/lib/bb/__init__.py +12 -0
index 8b6ea2d8ed0..b04d4c8a831 100644
@@ -36,6 +36,7 @@ class BBHandledException(Exception):
 
 import os
 import logging
+from collections import namedtuple
 
 
 class NullHandler(logging.Handler):
@@ -227,3 +228,14 @@ def deprecate_import(current, modulename, fromlist, renames = None):
 
         setattr(sys.modules[current], newname, newobj)
 
+TaskData = namedtuple("TaskData", [
+    "pn",
+    "taskname",
+    "fn",
+    "deps",
+    "provides",
+    "taskhash",
+    "unihash",
+    "hashfn",
+    "taskhash_deps",
+])
bitbake/lib/bb/runqueue.py +27 -18

65 lines not on this page · raw message

Signature · 1 line
2.43.2