[PATCH v2] binman: Fix typing for python >= 3.5
Yannic Moog
y.moog at phytec.de
Mon Jul 14 07:44:32 CEST 2025
To make it work with python 3.5 and 3.6, need type hints from the
typing module.
Reported-by: Tim Harvey <tharvey at gateworks.com>
Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged image")
Signed-off-by: Yannic Moog <y.moog at phytec.de>
---
Changes in v2:
- drop newline changes
- Link to v1: https://lore.kernel.org/r/20250711-binman-typing-fix-v1-1-66ab075015ac@phytec.de
---
tools/binman/etype/cbfs.py | 3 ++-
tools/binman/etype/mkimage.py | 3 ++-
tools/binman/etype/section.py | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index 5879f377231bf94697bea97c3cfc3a2515665b8f..c5e77f3a0df22ff768aa7254e4dd9ecbe6f81684 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -6,6 +6,7 @@
#
from collections import OrderedDict
+from typing import Dict
from binman import cbfs_util
from binman.cbfs_util import CbfsWriter
@@ -276,7 +277,7 @@ class Entry_cbfs(Entry):
for entry in self._entries.values():
entry.ListEntries(entries, indent + 1)
- def GetEntries(self) -> dict[str, Entry]:
+ def GetEntries(self) -> Dict[str, Entry]:
"""Returns the entries (tree children) of this section"""
return self._entries
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 75e59c3d3a3104da7559982f64968fdd99b7bd5f..9f68f3386bd4d6615a9c917de6b783c2d20b31ee 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -6,6 +6,7 @@
#
from collections import OrderedDict
+from typing import Dict
from binman.entry import Entry
from binman.etype.section import Entry_section
@@ -205,7 +206,7 @@ class Entry_mkimage(Entry_section):
self.record_missing_bintool(self.mkimage)
return data
- def GetEntries(self) -> dict[str, Entry]:
+ def GetEntries(self) -> Dict[str, Entry]:
# Make a copy so we don't change the original
entries = OrderedDict(self._entries)
if self._imagename:
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 03c4f7c6ec74c6fa75c9362e2fecdb0e6ab568cb..471c6fa55879c3d568ea642750348df216fa1e18 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -12,6 +12,7 @@ from collections import OrderedDict
import concurrent.futures
import re
import sys
+from typing import Dict
from binman.entry import Entry
from binman import state
@@ -537,7 +538,7 @@ class Entry_section(Entry):
for entry in self._entries.values():
entry.WriteMap(fd, indent + 1)
- def GetEntries(self) -> dict[str, Entry]:
+ def GetEntries(self) -> Dict[str, Entry]:
return self._entries
def GetContentsByPhandle(self, phandle, source_entry, required):
---
base-commit: 6bb0679377abb01a82db1ce69b5bf1d40aa02ace
change-id: 20250710-binman-typing-fix-a207bed6416b
Best regards,
--
Yannic Moog <y.moog at phytec.de>
More information about the U-Boot
mailing list