To make it work with python 3.5 and 3.6, need type hints from the typing module.
Reported-by: Tim Harvey <thar...@gateworks.com> Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged image") Signed-off-by: Yannic Moog <y.m...@phytec.de> --- tools/binman/etype/cbfs.py | 3 ++- tools/binman/etype/mkimage.py | 4 +++- tools/binman/etype/section.py | 4 ++-- 3 files changed, 7 insertions(+), 4 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..d324229a825d67991bc7c23329c6e377f15d0397 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -6,12 +6,14 @@ # from collections import OrderedDict +from typing import Dict from binman.entry import Entry from binman.etype.section import Entry_section from dtoc import fdt_util from u_boot_pylib import tools + class Entry_mkimage(Entry_section): """Binary produced by mkimage @@ -205,7 +207,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..1e31dcb1f1c7defd176fd1a7560d9efc38141d3d 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2018 Google, Inc # Written by Simon Glass <s...@chromium.org> - """Entry-type module for sections (groups of entries) Sections are entries which can contain other entries. This allows hierarchical @@ -12,6 +11,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 +537,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.m...@phytec.de>