binman: migrate from pkg_resources to importlib
authorYannic Moog <y.moog@phytec.de>
Tue, 1 Jul 2025 05:45:37 +0000 (07:45 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 9 Jul 2025 16:39:22 +0000 (10:39 -0600)
commit538719cb6a77934d069e0e64f264457a59a9ebfc
tree4b64de6efb1e56acf075926dd34302afa402c130
parentbbca681cde3f0859847bd542e491294fd9d67656
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>
tools/binman/control.py