Skip to content

Commit 725cf09

Browse files
richtjaclebergnu
authored andcommitted
cannot import name 'packaging' from 'pkg_resources' fix
In the setuptools>=70 the `pkg_resources` is deprecated and some of its features might cause troubles. These changes have impact on avocado CI with python3.12. This commit uses directly the `packaging` package instead of `pkg_resources` which solves the CI issues. Reference: https://setuptools.pypa.io/en/stable/pkg_resources.html#package-discovery-and-resource-access-using-pkg-resources Signed-off-by: Jan Richter <[email protected]>
1 parent 6b5c5ab commit 725cf09

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

avocado/utils/kernel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import shutil
2424
import tempfile
2525

26-
from pkg_resources import packaging
26+
from packaging.version import parse
2727

2828
from avocado.utils import archive, asset, build, distro, process
2929

@@ -208,6 +208,6 @@ def check_version(version):
208208
:type version: string
209209
:param version: version to be compared with current kernel version
210210
"""
211-
os_version = packaging.version.parse(os.uname()[2])
212-
version = packaging.version.parse(version)
211+
os_version = parse(os.uname()[2])
212+
version = parse(version)
213213
assert os_version > version, "Old kernel"

0 commit comments

Comments
 (0)