From 58738b61a8bd6af542ff82a2ccccb49551c48c1b Mon Sep 17 00:00:00 2001 From: Jan Richter Date: Mon, 12 Aug 2024 16:13:24 +0200 Subject: [PATCH] Backwards compatibility for kernel utils module This is a fix of kerne utils compatibility issue with setuptools=>70 which has been introduced in df6b1da. Reference: #5988 Signed-off-by: Jan Richter --- avocado/utils/kernel.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/avocado/utils/kernel.py b/avocado/utils/kernel.py index 74b33eeaee..85aad05727 100644 --- a/avocado/utils/kernel.py +++ b/avocado/utils/kernel.py @@ -23,7 +23,10 @@ import shutil import tempfile -from packaging.version import parse +try: + import packaging +except ImportError: + from pkg_resources import packaging from avocado.utils import archive, asset, build, distro, process @@ -207,6 +210,6 @@ def check_version(version): :type version: string :param version: version to be compared with current kernel version """ - os_version = parse(os.uname()[2]) - version = parse(version) + os_version = packaging.version.parse(os.uname()[2]) + version = packaging.version.parse(version) assert os_version > version, "Old kernel"