diff mbox series

[meta-ti,master,2/2] u-boot-ti-staging_2025.01: Backport fix for python3-setuptools change

Message ID 20260316171305.3378319-2-reatmon@ti.com
State Accepted
Delegated to: Ryan Eatmon
Headers show
Series [meta-ti,master,1/2] linux-ti-staging_6.12: Backport C23 compile fix from linux-stable | expand

Commit Message

Ryan Eatmon March 16, 2026, 5:13 p.m. UTC
A recent change in oe-core [1] to bump the python3-setuptools change
introduced a build error with the 2025.01 version of u-boot in binman.
Backport a fix from the master branch of u-boot [2] to address this.

[1] https://git.openembedded.org/openembedded-core/commit/?id=ab6b2bf7b555d3516abea6255b800fe6f9673a69
[2] https://github.com/u-boot/u-boot/commit/538719cb6a77934d069e0e64f264457a59a9ebfc

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
 .../u-boot/u-boot-ti-staging_2025.01.bb       |  2 +
 ...rate-form-pkg_resources-to-importlib.patch | 73 +++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 meta-ti-bsp/recipes-bsp/u-boot/u-boot/0001-binman-migrate-form-pkg_resources-to-importlib.patch
diff mbox series

Patch

diff --git a/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti-staging_2025.01.bb b/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti-staging_2025.01.bb
index 08bba71b..6fef7e91 100644
--- a/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti-staging_2025.01.bb
+++ b/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti-staging_2025.01.bb
@@ -5,3 +5,5 @@  PR = "r0"
 BRANCH = "ti-u-boot-2025.01"
 
 SRCREV_uboot = "ef2eb76b650415637bd93b0eddfb1e31489117f9"
+
+SRC_URI += "file://0001-binman-migrate-form-pkg_resources-to-importlib.patch"
diff --git a/meta-ti-bsp/recipes-bsp/u-boot/u-boot/0001-binman-migrate-form-pkg_resources-to-importlib.patch b/meta-ti-bsp/recipes-bsp/u-boot/u-boot/0001-binman-migrate-form-pkg_resources-to-importlib.patch
new file mode 100644
index 00000000..854eb6df
--- /dev/null
+++ b/meta-ti-bsp/recipes-bsp/u-boot/u-boot/0001-binman-migrate-form-pkg_resources-to-importlib.patch
@@ -0,0 +1,73 @@ 
+From 538719cb6a77934d069e0e64f264457a59a9ebfc Mon Sep 17 00:00:00 2001
+From: Yannic Moog <y.moog@phytec.de>
+Date: Tue, 1 Jul 2025 07:45:37 +0200
+Subject: [PATCH] binman: migrate from pkg_resources to importlib
+
+pkg_resources is deprecated, use migration guide in [1] to migrate to
+importlib.resources.
+Keep the Python 3.6 backwards compatibility.
+This also fixes the binman version test which failed for setuptools
+versions that print the deprecation warning.
+Change from __name__ to __package__ as with the transition from
+pkg_resources to importlib_resources using __name__ results in
+TypeErrors [2].
+
+[1] https://importlib-resources.readthedocs.io/en/latest/migration.html
+[2] https://github.com/python/importlib_resources/issues/60
+
+Reviewed-by: Bryan Brattlof <bb@ti.com>
+Signed-off-by: Yannic Moog <y.moog@phytec.de>
+
+Upstream-Status: Backport
+---
+ tools/binman/control.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/tools/binman/control.py b/tools/binman/control.py
+index af447d792a7f..1307222591de 100644
+--- a/tools/binman/control.py
++++ b/tools/binman/control.py
+@@ -8,12 +8,11 @@
+ from collections import OrderedDict
+ import glob
+ try:
+-    import importlib.resources
++    import importlib.resources as importlib_resources
+ except ImportError:  # pragma: no cover
+     # for Python 3.6
+     import importlib_resources
+ import os
+-import pkg_resources
+ import re
+ 
+ import sys
+@@ -96,7 +95,7 @@ def _FinishTag(tag, msg, result):
+             msg = ''
+         return tag, msg
+ 
+-    my_data = pkg_resources.resource_string(__name__, 'missing-blob-help')
++    my_data = importlib_resources.files(__package__).joinpath('missing-blob-help').read_bytes()
+     re_tag = re.compile('^([-a-z0-9]+):$')
+     result = {}
+     tag = None
+@@ -151,8 +150,9 @@ def GetEntryModules(include_testing=True):
+     Returns:
+         Set of paths to entry class filenames
+     """
+-    glob_list = pkg_resources.resource_listdir(__name__, 'etype')
+-    glob_list = [fname for fname in glob_list if fname.endswith('.py')]
++    entries = importlib_resources.files(__package__).joinpath('etype')
++    glob_list = [entry.name for entry in entries.iterdir()
++                 if entry.name.endswith('.py') and entry.is_file()]
+     return set([os.path.splitext(os.path.basename(item))[0]
+                 for item in glob_list
+                 if include_testing or '_testing' not in item])
+@@ -756,7 +756,7 @@ def Binman(args):
+     global state
+ 
+     if args.full_help:
+-        with importlib.resources.path('binman', 'README.rst') as readme:
++        with importlib_resources.path('binman', 'README.rst') as readme:
+             tools.print_full_help(str(readme))
+         return 0
+