| Message ID | 20260403033841.2186031-1-haiqing.bai@windriver.com |
|---|---|
| State | Under Review |
| Headers | show |
| Series | [meta-python] python3-stopit: Fixed the deprecated pkg_resources issue | expand |
On 4/3/26 05:38, haiqing.bai via lists.openembedded.org wrote: > From: "Bai, Haiqing" <Haiqing.Bai@windriver.com> > > pkg_resources is deprecated as an API. The pkg_resources package > has been removed from setuptools, so the way of obtaining the > version needs to be replaced with importlib.metadata module. > > Signed-off-by: Bai, Haiqing <Haiqing.Bai@windriver.com> > --- > ...01-Drop-the-deprecated-pkg_resources.patch | 38 +++++++++++++++++++ > .../python/python3-stopit_1.1.2.bb | 6 ++- > 2 files changed, 43 insertions(+), 1 deletion(-) > create mode 100644 meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > > diff --git a/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch b/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > new file mode 100644 > index 0000000000..4252386384 > --- /dev/null > +++ b/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > @@ -0,0 +1,38 @@ > +From b72825c89724c2c3b4c9c60d90c9d4ad597eead0 Mon Sep 17 00:00:00 2001 > +From: "Bai, Haiqing" <Haiqing.Bai@windriver.com> > +Date: Thu, 2 Apr 2026 08:40:26 +0000 > +Subject: [PATCH] Drop the deprecated pkg_resources > + > +pkg_resources is deprecated as an API. The pkg_resources package > +is slated for removal, so the way of obtaining the version needs > +to be updated. > + > +Upstream-Status: Inactive-Upstream [lastcommit: Jan/2024 lastrelease: Feb/2018] > + > +Signed-off-by: Bai, Haiqing <Haiqing.Bai@windriver.com> > +--- > + src/stopit/__init__.py | 4 ++-- > + 1 file changed, 2 insertions(+), 2 deletions(-) > + > +diff --git a/src/stopit/__init__.py b/src/stopit/__init__.py > +index 6ca0180..5ddfa4a 100644 > +--- a/src/stopit/__init__.py > ++++ b/src/stopit/__init__.py > +@@ -7,7 +7,7 @@ stopit > + Public resources from ``stopit`` > + """ > + > +-import pkg_resources > ++from importlib.metadata import version > + > + from .utils import LOG, TimeoutException > + from .threadstop import ThreadingTimeout, async_raise, threading_timeoutable > +@@ -15,7 +15,7 @@ from .signalstop import SignalTimeout, signal_timeoutable > + > + # PEP 396 style version marker > + try: > +- __version__ = pkg_resources.get_distribution(__name__).version > ++ __version__ = version(__name__) > + except: > + LOG.warning("Could not get the package version from pkg_resources") > + __version__ = 'unknown' > diff --git a/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb b/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > index a952722619..a83adffcd2 100644 > --- a/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > +++ b/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > @@ -2,7 +2,6 @@ SUMMARY = "Raise asynchronous exceptions in other threads, control the timeout o > HOMEPAGE = "https://pypi.org/project/stopit/" > SECTION = "devel/python" > > -SRC_URI += " file://LICENSE " > LICENSE = "MIT" > LIC_FILES_CHKSUM = "file://${UNPACKDIR}/LICENSE;md5=497c556f42b1355b64190da2f3d88f93" > > @@ -10,6 +9,11 @@ SRC_URI[sha256sum] = "f7f39c583fd92027bd9d06127b259aee7a5b7945c1f1fa56263811e1e7 > > inherit pypi setuptools3 > > +SRC_URI += "\ > + file://LICENSE \ > + file://0001-Drop-the-deprecated-pkg_resources.patch \ > +" > + > RDEPENDS:${PN} += "\ > python3-setuptools \ > " After this patch, does it still have a runtime dependency on setuptools? I think maybe that was the only reason for pulling this in
On Fri, Apr 3, 2026 at 1:50 AM Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote: > On 4/3/26 05:38, haiqing.bai via lists.openembedded.org wrote: > > From: "Bai, Haiqing" <Haiqing.Bai@windriver.com> > > > > pkg_resources is deprecated as an API. The pkg_resources package > > has been removed from setuptools, so the way of obtaining the > > version needs to be replaced with importlib.metadata module. > > > > Signed-off-by: Bai, Haiqing <Haiqing.Bai@windriver.com> > > --- > > ...01-Drop-the-deprecated-pkg_resources.patch | 38 +++++++++++++++++++ > > .../python/python3-stopit_1.1.2.bb | 6 ++- > > 2 files changed, 43 insertions(+), 1 deletion(-) > > create mode 100644 > meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > > > > diff --git > a/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > b/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > > new file mode 100644 > > index 0000000000..4252386384 > > --- /dev/null > > +++ > b/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch > > @@ -0,0 +1,38 @@ > > +From b72825c89724c2c3b4c9c60d90c9d4ad597eead0 Mon Sep 17 00:00:00 2001 > > +From: "Bai, Haiqing" <Haiqing.Bai@windriver.com> > > +Date: Thu, 2 Apr 2026 08:40:26 +0000 > > +Subject: [PATCH] Drop the deprecated pkg_resources > > + > > +pkg_resources is deprecated as an API. The pkg_resources package > > +is slated for removal, so the way of obtaining the version needs > > +to be updated. > > + > > +Upstream-Status: Inactive-Upstream [lastcommit: Jan/2024 lastrelease: > Feb/2018] > > + > > +Signed-off-by: Bai, Haiqing <Haiqing.Bai@windriver.com> > > +--- > > + src/stopit/__init__.py | 4 ++-- > > + 1 file changed, 2 insertions(+), 2 deletions(-) > > + > > +diff --git a/src/stopit/__init__.py b/src/stopit/__init__.py > > +index 6ca0180..5ddfa4a 100644 > > +--- a/src/stopit/__init__.py > > ++++ b/src/stopit/__init__.py > > +@@ -7,7 +7,7 @@ stopit > > + Public resources from ``stopit`` > > + """ > > + > > +-import pkg_resources > > ++from importlib.metadata import version > > + > > + from .utils import LOG, TimeoutException > > + from .threadstop import ThreadingTimeout, async_raise, > threading_timeoutable > > +@@ -15,7 +15,7 @@ from .signalstop import SignalTimeout, > signal_timeoutable > > + > > + # PEP 396 style version marker > > + try: > > +- __version__ = pkg_resources.get_distribution(__name__).version > > ++ __version__ = version(__name__) > > + except: > > + LOG.warning("Could not get the package version from pkg_resources") > > + __version__ = 'unknown' > > diff --git a/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > b/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > > index a952722619..a83adffcd2 100644 > > --- a/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > > +++ b/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb > > @@ -2,7 +2,6 @@ SUMMARY = "Raise asynchronous exceptions in other > threads, control the timeout o > > HOMEPAGE = "https://pypi.org/project/stopit/" > > SECTION = "devel/python" > > > > -SRC_URI += " file://LICENSE " > > LICENSE = "MIT" > > LIC_FILES_CHKSUM = > "file://${UNPACKDIR}/LICENSE;md5=497c556f42b1355b64190da2f3d88f93" > > > > @@ -10,6 +9,11 @@ SRC_URI[sha256sum] = > "f7f39c583fd92027bd9d06127b259aee7a5b7945c1f1fa56263811e1e7 > > > > inherit pypi setuptools3 > > > > +SRC_URI += "\ > > + file://LICENSE \ > > + file://0001-Drop-the-deprecated-pkg_resources.patch \ > > +" > > + > > RDEPENDS:${PN} += "\ > > python3-setuptools \ > > " > > > After this patch, does it still have a runtime dependency on setuptools? > I think maybe that was the only reason for pulling this in > > Good question. It was added with https://git.openembedded.org/meta-openembedded/commit/?id=812f091414b34dbebe4a3990c9039cbaadc4dd71 to fix ModuleNotFoundError: No module named 'pkg_resources' on target. So perhaps it should be reverted now as well. Please test it out and send a revert of the above commit as a followup. > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#125980): > https://lists.openembedded.org/g/openembedded-devel/message/125980 > Mute This Topic: https://lists.openembedded.org/mt/118646263/1997914 > Group Owner: openembedded-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ > raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch b/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch new file mode 100644 index 0000000000..4252386384 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-stopit/0001-Drop-the-deprecated-pkg_resources.patch @@ -0,0 +1,38 @@ +From b72825c89724c2c3b4c9c60d90c9d4ad597eead0 Mon Sep 17 00:00:00 2001 +From: "Bai, Haiqing" <Haiqing.Bai@windriver.com> +Date: Thu, 2 Apr 2026 08:40:26 +0000 +Subject: [PATCH] Drop the deprecated pkg_resources + +pkg_resources is deprecated as an API. The pkg_resources package +is slated for removal, so the way of obtaining the version needs +to be updated. + +Upstream-Status: Inactive-Upstream [lastcommit: Jan/2024 lastrelease: Feb/2018] + +Signed-off-by: Bai, Haiqing <Haiqing.Bai@windriver.com> +--- + src/stopit/__init__.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/stopit/__init__.py b/src/stopit/__init__.py +index 6ca0180..5ddfa4a 100644 +--- a/src/stopit/__init__.py ++++ b/src/stopit/__init__.py +@@ -7,7 +7,7 @@ stopit + Public resources from ``stopit`` + """ + +-import pkg_resources ++from importlib.metadata import version + + from .utils import LOG, TimeoutException + from .threadstop import ThreadingTimeout, async_raise, threading_timeoutable +@@ -15,7 +15,7 @@ from .signalstop import SignalTimeout, signal_timeoutable + + # PEP 396 style version marker + try: +- __version__ = pkg_resources.get_distribution(__name__).version ++ __version__ = version(__name__) + except: + LOG.warning("Could not get the package version from pkg_resources") + __version__ = 'unknown' diff --git a/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb b/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb index a952722619..a83adffcd2 100644 --- a/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb +++ b/meta-python/recipes-devtools/python/python3-stopit_1.1.2.bb @@ -2,7 +2,6 @@ SUMMARY = "Raise asynchronous exceptions in other threads, control the timeout o HOMEPAGE = "https://pypi.org/project/stopit/" SECTION = "devel/python" -SRC_URI += " file://LICENSE " LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${UNPACKDIR}/LICENSE;md5=497c556f42b1355b64190da2f3d88f93" @@ -10,6 +9,11 @@ SRC_URI[sha256sum] = "f7f39c583fd92027bd9d06127b259aee7a5b7945c1f1fa56263811e1e7 inherit pypi setuptools3 +SRC_URI += "\ + file://LICENSE \ + file://0001-Drop-the-deprecated-pkg_resources.patch \ +" + RDEPENDS:${PN} += "\ python3-setuptools \ "