diff options
Diffstat (limited to 'meta-python/recipes-devtools/python')
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 @@ | |||
| 1 | From 81b0218e390e36aa2c3d1bdaa124d8af175e9cbb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li Zhou <li.zhou@windriver.com> | ||
| 3 | Date: Thu, 2 Apr 2026 15:44:18 +0800 | ||
| 4 | Subject: [PATCH] Not use functions from pkg_resources any more | ||
| 5 | |||
| 6 | The python3 setuptools 82 dropped pkg_resources module by now. | ||
| 7 | To avoid the failure "No module named 'pkg_resources'", replace the | ||
| 8 | functions from this module with other functions from modules | ||
| 9 | packaging and importlib.metadata. | ||
| 10 | |||
| 11 | Upstream-Status: Inactive-Upstream [lastcommit: 2023] | ||
| 12 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
| 13 | --- | ||
| 14 | ptr/__init__.py | 23 +++++++++++++---------- | ||
| 15 | 1 file changed, 13 insertions(+), 10 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/ptr/__init__.py b/ptr/__init__.py | ||
| 18 | index 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 | -- | ||
| 76 | 2.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 | ||
| 6 | SRC_URI[sha256sum] = "70d4739585a7008f37bf4933c013fdb327b8878a5a69fcbb3316c88882f0f49b" | 6 | SRC_URI[sha256sum] = "70d4739585a7008f37bf4933c013fdb327b8878a5a69fcbb3316c88882f0f49b" |
| 7 | 7 | ||
| 8 | SRC_URI += " \ | ||
| 9 | file://0001-Not-use-functions-from-pkg_resources-any-more.patch \ | ||
| 10 | " | ||
| 11 | |||
| 8 | inherit pypi python_setuptools_build_meta | 12 | inherit pypi python_setuptools_build_meta |
| 9 | 13 | ||
| 10 | DEPENDS += " \ | 14 | DEPENDS += " \ |
