--- a/src/eric7/Globals/__init__.py Mon Feb 06 15:03:54 2023 +0100 +++ b/src/eric7/Globals/__init__.py Mon Feb 06 17:15:20 2023 +0100 @@ -11,9 +11,9 @@ # Note: Do not import any eric stuff in here!!!!!!! # -import contextlib import os -import re + +import semver from PyQt6.QtCore import QByteArray, QCoreApplication, QProcess, qVersion @@ -135,19 +135,13 @@ @type str @param length desired length of the version tuple @type int - @return version tuple without the suffix - @rtype tuple of int + @return version named tuple containing the version parts + @rtype semver.VersionInfo """ - versionParts = [] - - # step 1: extract suffix - version = re.split(r"[^\d.]", version)[0] - for part in version.split("."): - with contextlib.suppress(ValueError): - versionParts.append(int(part.strip())) - versionParts.extend([0] * length) - - return tuple(versionParts[:length]) + if semver.VersionInfo.isvalid(version): + return semver.VersionInfo.parse(version) + else: + return semver.VersionInfo(0, 0, 0) ###############################################################################