summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python
diff options
context:
space:
mode:
authorLi Zhou <li.zhou@windriver.com>2026-04-07 16:48:20 +0800
committerKhem Raj <khem.raj@oss.qualcomm.com>2026-04-07 08:44:51 -0700
commitbd0afe0669ec19b23de1616efae80b12382b498e (patch)
tree0fb854ab54bdab7a754cab7fb2032e27c97eb891 /meta-python/recipes-devtools/python
parentaec06eecb4ccf726f60c965634042cd1ae695f5a (diff)
downloadmeta-openembedded-bd0afe0669ec19b23de1616efae80b12382b498e.tar.gz
python3-pytest-runner: remove using pkg_resources
The python3 setuptools 82 dropped pkg_resources module by now. To avoid the failure "No module named 'pkg_resources'", replace the functions from this module with other functions from modules packaging and importlib.metadata. Signed-off-by: Li Zhou <li.zhou@windriver.com> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Diffstat (limited to 'meta-python/recipes-devtools/python')
-rw-r--r--meta-python/recipes-devtools/python/python3-pytest-runner/0001-Not-use-functions-from-pkg_resources-any-more.patch77
-rw-r--r--meta-python/recipes-devtools/python/python3-pytest-runner_6.0.1.bb4
2 files changed, 81 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pytest-runner/0001-Not-use-functions-from-pkg_resources-any-more.patch b/meta-python/recipes-devtools/python/python3-pytest-runner/0001-Not-use-functions-from-pkg_resources-any-more.patch
new file mode 100644
index 0000000000..20c1c121fb
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-runner/0001-Not-use-functions-from-pkg_resources-any-more.patch
@@ -0,0 +1,77 @@
1From 81b0218e390e36aa2c3d1bdaa124d8af175e9cbb Mon Sep 17 00:00:00 2001
2From: Li Zhou <li.zhou@windriver.com>
3Date: Thu, 2 Apr 2026 15:44:18 +0800
4Subject: [PATCH] Not use functions from pkg_resources any more
5
6The python3 setuptools 82 dropped pkg_resources module by now.
7To avoid the failure "No module named 'pkg_resources'", replace the
8functions from this module with other functions from modules
9packaging and importlib.metadata.
10
11Upstream-Status: Inactive-Upstream [lastcommit: 2023]
12Signed-off-by: Li Zhou <li.zhou@windriver.com>
13---
14 ptr/__init__.py | 23 +++++++++++++----------
15 1 file changed, 13 insertions(+), 10 deletions(-)
16
17diff --git a/ptr/__init__.py b/ptr/__init__.py
18index 41192fa..5186059 100644
19--- a/ptr/__init__.py
20+++ b/ptr/__init__.py
21@@ -10,10 +10,12 @@ import operator as _operator
22 import itertools as _itertools
23 import warnings as _warnings
24
25-import pkg_resources
26 import setuptools.command.test as orig
27 from setuptools import Distribution
28
29+from importlib.metadata import version
30+from packaging.version import Version
31+from packaging.markers import Marker, InvalidMarker
32
33 @_contextlib.contextmanager
34 def _save_argv(repl=None):
35@@ -121,7 +123,8 @@ class PyTest(orig.test):
36 instead of declaring the dependency in the package
37 metadata, assert the requirement at run time.
38 """
39- pkg_resources.require('setuptools>=27.3')
40+ if Version(version('setuptools')) < Version('27.3'):
41+ raise RuntimeError("setuptools >= 27.3 is required")
42
43 def finalize_options(self):
44 if self.addopts:
45@@ -133,11 +136,12 @@ class PyTest(orig.test):
46 Given an environment marker, return True if the marker is valid
47 and matches this environment.
48 """
49- return (
50- not marker
51- or not pkg_resources.invalid_marker(marker)
52- and pkg_resources.evaluate_marker(marker)
53- )
54+ if not marker:
55+ return True
56+ try:
57+ return Marker(marker).evaluate()
58+ except InvalidMarker:
59+ return False
60
61 def install_dists(self, dist):
62 """
63@@ -175,9 +179,8 @@ class PyTest(orig.test):
64 "please upgrade to setuptools 30.4 or later or pin to "
65 "pytest-runner < 5."
66 )
67- ver_str = pkg_resources.get_distribution('setuptools').version
68- ver = pkg_resources.parse_version(ver_str)
69- if ver < pkg_resources.parse_version('30.4'):
70+ ver = Version(version('setuptools'))
71+ if ver < Version('30.4'):
72 _warnings.warn(msg)
73
74 def run(self):
75--
762.34.1
77
diff --git a/meta-python/recipes-devtools/python/python3-pytest-runner_6.0.1.bb b/meta-python/recipes-devtools/python/python3-pytest-runner_6.0.1.bb
index e5e5e048bd..dd3a8d0234 100644
--- a/meta-python/recipes-devtools/python/python3-pytest-runner_6.0.1.bb
+++ b/meta-python/recipes-devtools/python/python3-pytest-runner_6.0.1.bb
@@ -5,6 +5,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=7a7126e068206290f3fe9f8d6c713ea6"
5 5
6SRC_URI[sha256sum] = "70d4739585a7008f37bf4933c013fdb327b8878a5a69fcbb3316c88882f0f49b" 6SRC_URI[sha256sum] = "70d4739585a7008f37bf4933c013fdb327b8878a5a69fcbb3316c88882f0f49b"
7 7
8SRC_URI += " \
9 file://0001-Not-use-functions-from-pkg_resources-any-more.patch \
10 "
11
8inherit pypi python_setuptools_build_meta 12inherit pypi python_setuptools_build_meta
9 13
10DEPENDS += " \ 14DEPENDS += " \