[PATCH v3] binman: Fix typing for python >= 3.7

Tim Harvey tharvey at gateworks.com
Tue Jul 15 18:20:23 CEST 2025


On Mon, Jul 14, 2025 at 11:21 PM Yannic Moog <y.moog at phytec.de> wrote:
>
> To get the [] annotation working with python 3.7 and 3.8, import
> annotations.
>
> Reported-by: Tim Harvey <tharvey at gateworks.com>
> Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged image")
> Reviewed-by: Bryan Brattlof <bb at ti.com>
> Signed-off-by: Yannic Moog <y.moog at phytec.de>
> ---
> 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/20250714-binman-typing-fix-v2-1-dbe6519c43a0@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    | 1 +
>  tools/binman/etype/mkimage.py | 1 +
>  tools/binman/etype/section.py | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
> index 5879f377231bf94697bea97c3cfc3a2515665b8f..9cc4b756b3f735b51d66f790cc61d77e50f18eea 100644
> --- a/tools/binman/etype/cbfs.py
> +++ b/tools/binman/etype/cbfs.py
> @@ -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
> diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
> index 75e59c3d3a3104da7559982f64968fdd99b7bd5f..9fba902bdadfbde3b9c50ba983a475b30aca305f 100644
> --- a/tools/binman/etype/mkimage.py
> +++ b/tools/binman/etype/mkimage.py
> @@ -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
> diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
> index 03c4f7c6ec74c6fa75c9362e2fecdb0e6ab568cb..6a26d687056bbb4eaece869916ea1a796ec1bd95 100644
> --- a/tools/binman/etype/section.py
> +++ b/tools/binman/etype/section.py
> @@ -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,
> --
> Yannic Moog <y.moog at phytec.de>
>

Thanks Yannic,

This one works for me as well.

Tested-by: Tim Harvey <tharvey at gateworks.com> (Python 3.8.10 on Ubuntu
24.04.6 LTS)

Best Regards,

Tim


More information about the U-Boot mailing list