Skip to contentSkip to conversation

binman: Fix typing for python >= 3.7

PATCH In review Yannic Moog 3 participants 3 messages Jul 15, 2025 – Jul 22, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 binman: Fix typing for python >= 3.7

To get the [] annotation working with python 3.7 and 3.8, import annotations.

Fixes 21bc3433a43d ("binman: rework dropping absent entries from packaged image")

---
Changes in v3:
- drop the deprecated and soon-to-be-removed typing package needed for
python 3.6 and 3.5 support. Instead use __future__ which is supported
by python >= 3.7
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- drop newline changes
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 tools/binman/etype/cbfs.py    | 1 +
 tools/binman/etype/mkimage.py | 1 +
 tools/binman/etype/section.py | 1 +
 3 files changed, 3 insertions(+)
tools/binman/etype/cbfs.py +1 -0
index 5879f377231bf94697bea97c3cfc3a2515665b8f..9cc4b756b3f735b51d66f790cc61d77e50f18eea 100644
@@ -5,6 +5,7 @@
 # Entry-type module for a Coreboot Filesystem (CBFS)
 #
 
+from __future__ import annotations
 from collections import OrderedDict
 
 from binman import cbfs_util
tools/binman/etype/mkimage.py +1 -0
index 75e59c3d3a3104da7559982f64968fdd99b7bd5f..9fba902bdadfbde3b9c50ba983a475b30aca305f 100644
@@ -5,6 +5,7 @@
 # Entry-type module for producing an image using mkimage
 #
 
+from __future__ import annotations
 from collections import OrderedDict
 
 from binman.entry import Entry
tools/binman/etype/section.py +1 -0
index 03c4f7c6ec74c6fa75c9362e2fecdb0e6ab568cb..6a26d687056bbb4eaece869916ea1a796ec1bd95 100644
@@ -8,6 +8,7 @@ Sections are entries which can contain other entries. This allows hierarchical
 images to be created.
 """
 
+from __future__ import annotations
 from collections import OrderedDict
 import concurrent.futures
 import re

---
base-commit: 6bb0679377abb01a82db1ce69b5bf1d40aa02ace
change-id: 20250710-binman-typing-fix-a207bed6416b

Best regards,

Signature · 1 line
Yannic Moog <[email protected]>
Tested-by on v3 1/1
#1 lore raw
Quoted 65 lines · Yannic Moog

To get the [] annotation working with python 3.7 and 3.8, import annotations.

Fixes 21bc3433a43d ("binman: rework dropping absent entries from packaged image")

---
Changes in v3:
- drop the deprecated and soon-to-be-removed typing package needed for
python 3.6 and 3.5 support. Instead use __future__ which is supported
by python >= 3.7
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- drop newline changes
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 tools/binman/etype/cbfs.py    | 1 +
 tools/binman/etype/mkimage.py | 1 +
 tools/binman/etype/section.py | 1 +
 3 files changed, 3 insertions(+)
tools/binman/etype/cbfs.py +1 -0
index 5879f377231bf94697bea97c3cfc3a2515665b8f..9cc4b756b3f735b51d66f790cc61d77e50f18eea 100644
@@ -5,6 +5,7 @@
 # Entry-type module for a Coreboot Filesystem (CBFS)
 #
 
+from __future__ import annotations
 from collections import OrderedDict
 
 from binman import cbfs_util
tools/binman/etype/mkimage.py +1 -0
index 75e59c3d3a3104da7559982f64968fdd99b7bd5f..9fba902bdadfbde3b9c50ba983a475b30aca305f 100644
@@ -5,6 +5,7 @@
 # Entry-type module for producing an image using mkimage
 #
 
+from __future__ import annotations
 from collections import OrderedDict
 
 from binman.entry import Entry
tools/binman/etype/section.py +1 -1
index 03c4f7c6ec74c6fa75c9362e2fecdb0e6ab568cb..6a26d687056bbb4eaece869916ea1a796ec1bd95 100644
@@ -8,6 +8,7 @@ Sections are entries which can contain other entries. This allows hierarchical
 images to be created.
 """
 
+from __future__ import annotations
 from collections import OrderedDict
 import concurrent.futures
 import re
 
---

base-commit: 6bb0679377abb01a82db1ce69b5bf1d40aa02ace
change-id: 20250710-binman-typing-fix-a207bed6416b

Quoted 4 lines

Best regards,
--
Yannic Moog <[email protected]>

Thanks Yannic,

This one works for me as well.

24.04.6 LTS)

Best Regards,

Tim

#2 lore raw
In reply to Yannic Moog
Quoted 5 lines · Yannic Moog

To get the [] annotation working with python 3.7 and 3.8, import annotations.

Tested-by:

Applied to u-boot/master, thanks!

[1/1] binman: Fix typing for python >= 3.7

      commit: 187ac12927c042a982961096c9a418287b8e97e2
Signature · 1 line
Tom