* [PATCH] binman: Fix typing for python >= 3.5
@ 2025-07-11 9:23 Yannic Moog
2025-07-11 15:04 ` Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Yannic Moog @ 2025-07-11 9:23 UTC (permalink / raw)
To: Simon Glass, Alper Nebi Yasak, Tom Rini, Yannic Moog,
Bryan Brattlof
Cc: u-boot, Tim Harvey
To make it work with python 3.5 and 3.6, need type hints from the
typing module.
Reported-by: Tim Harvey <tharvey@gateworks.com>
Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged image")
Signed-off-by: Yannic Moog <y.moog@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 <sjg@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.moog@phytec.de>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] binman: Fix typing for python >= 3.5
2025-07-11 9:23 [PATCH] binman: Fix typing for python >= 3.5 Yannic Moog
@ 2025-07-11 15:04 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2025-07-11 15:04 UTC (permalink / raw)
To: Yannic Moog
Cc: Simon Glass, Alper Nebi Yasak, Bryan Brattlof, u-boot, Tim Harvey
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
On Fri, Jul 11, 2025 at 11:23:27AM +0200, Yannic Moog wrote:
> To make it work with python 3.5 and 3.6, need type hints from the
> typing module.
>
> Reported-by: Tim Harvey <tharvey@gateworks.com>
> Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged image")
> Signed-off-by: Yannic Moog <y.moog@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(-)
There's some seemingly unrelated spacing changes in here, can you please
drop them unless required? Thanks.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-11 15:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11 9:23 [PATCH] binman: Fix typing for python >= 3.5 Yannic Moog
2025-07-11 15:04 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.