Skip to content

Commit

Permalink
cannot import name 'packaging' from 'pkg_resources' fix
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
richtja authored and clebergnu committed Jul 3, 2024
1 parent 6c02201 commit 42365c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avocado/utils/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import shutil
import tempfile

from pkg_resources import packaging
from packaging.version import parse

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

Expand Down Expand Up @@ -208,6 +208,6 @@ def check_version(version):
:type version: string
:param version: version to be compared with current kernel version
"""
os_version = packaging.version.parse(os.uname()[2])
version = packaging.version.parse(version)
os_version = parse(os.uname()[2])
version = parse(version)
assert os_version > version, "Old kernel"

0 comments on commit 42365c5

Please sign in to comment.