All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yannic Moog <y.moog@phytec.de>
To: Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>,
	Tom Rini <trini@konsulko.com>, Yannic Moog <y.moog@phytec.de>,
	Bryan Brattlof <bb@ti.com>
Cc: <u-boot@lists.denx.de>, Tim Harvey <tharvey@gateworks.com>
Subject: [PATCH] binman: Fix typing for python >= 3.5
Date: Fri, 11 Jul 2025 11:23:27 +0200	[thread overview]
Message-ID: <20250711-binman-typing-fix-v1-1-66ab075015ac@phytec.de> (raw)

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>


             reply	other threads:[~2025-07-11  9:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11  9:23 Yannic Moog [this message]
2025-07-11 15:04 ` [PATCH] binman: Fix typing for python >= 3.5 Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250711-binman-typing-fix-v1-1-66ab075015ac@phytec.de \
    --to=y.moog@phytec.de \
    --cc=alpernebiyasak@gmail.com \
    --cc=bb@ti.com \
    --cc=sjg@chromium.org \
    --cc=tharvey@gateworks.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.