1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

sanity/lib: Replace usage of LooseVersion() with bb.utils.vercmp_string_op()

distutils is going away and we have functionality in bitbake which can
handle these comparisions so switch to the bb.utils function.

(From OE-Core rev: fe624b520e6c75e16a8f394785ab0216341402f9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2021-11-26 16:31:17 +00:00
parent 1dbcdfcdf8
commit f062749071
3 changed files with 10 additions and 17 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ def find_latest_numeric_release(url, d):
maxstr=""
for link in get_links_from_url(url, d):
try:
# TODO use LooseVersion
# TODO use bb.utils.vercmp_string_op()
release = float(link)
except:
release = 0
+3 -4
View File
@@ -5,7 +5,6 @@ import logging
import oe.classutils
import shlex
from bb.process import Popen, ExecutionError
from distutils.version import LooseVersion
logger = logging.getLogger('BitBake.OE.Terminal')
@@ -86,10 +85,10 @@ class Konsole(XTerminal):
def __init__(self, sh_cmd, title=None, env=None, d=None):
# Check version
vernum = check_terminal_version("konsole")
if vernum and LooseVersion(vernum) < '2.0.0':
if vernum and bb.utils.vercmp_string_op(vernum, "2.0.0", "<"):
# Konsole from KDE 3.x
self.command = 'konsole -T "{title}" -e {command}'
elif vernum and LooseVersion(vernum) < '16.08.1':
elif vernum and bb.utils.vercmp_string_op(vernum, "16.08.1", "<"):
# Konsole pre 16.08.01 Has nofork
self.command = 'konsole --nofork --workdir . -p tabtitle="{title}" -e {command}'
XTerminal.__init__(self, sh_cmd, title, env, d)
@@ -260,7 +259,7 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
def check_tmux_version(desired):
vernum = check_terminal_version("tmux")
if vernum and LooseVersion(vernum) < desired:
if vernum and bb.utils.vercmp_string_op(vernum, desired, "<"):
return False
return vernum