Ignore text in the version string when comparing them

This commit is contained in:
cmdr2 2024-06-14 09:48:49 +05:30
parent a261a2d47d
commit 364902f8a1

View File

@ -15,6 +15,7 @@ import traceback
import shutil import shutil
from pathlib import Path from pathlib import Path
from pprint import pprint from pprint import pprint
import re
os_name = platform.system() os_name = platform.system()
@ -225,6 +226,7 @@ def install_pkg_if_necessary(pkg_name, required_version):
def version_str_to_tuple(ver_str): def version_str_to_tuple(ver_str):
ver_str = ver_str.split("+")[0] ver_str = ver_str.split("+")[0]
ver_str = re.sub("[^0-9.]", "", ver_str)
ver = ver_str.split(".") ver = ver_str.split(".")
return tuple(map(int, ver)) return tuple(map(int, ver))