bindings: python: tests: use the version parser from setuptools
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 6 Dec 2022 09:23:44 +0000 (10:23 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 6 Dec 2022 09:31:58 +0000 (10:31 +0100)
We currently require the third-party packaging module to be installed in
order to run tests. Let's instead use the version parser that's already
available in setuptools.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/tests/__init__.py

index 2bf14e6d86c07eae242b740d551a69ad8276219a..ecb96afcd0ad60e4ec2444a75a2f90e203245488 100644 (file)
@@ -4,12 +4,12 @@
 import os
 import unittest
 
-from packaging import version
+from setuptools._distutils.version import LooseVersion
 
-required_kernel_version = "5.19.0"
-current_version = os.uname().release.split("-")[0]
+required_kernel_version = LooseVersion("5.19.0")
+current_version = LooseVersion(os.uname().release.split("-")[0])
 
-if version.parse(current_version) < version.parse(required_kernel_version):
+if current_version < required_kernel_version:
     raise NotImplementedError(
         "linux kernel version must be at least {} - got {}".format(
             required_kernel_version, current_version