From: Serge Hallyn Date: Thu, 22 May 2025 11:27:11 +0000 (-0500) Subject: Revert "tests/: improve version detection" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46094d8e24a136f0a2213e1751f4bead09473283;p=thirdparty%2Fshadow.git Revert "tests/: improve version detection" This reverts commit df8c9743154589a22d95d0929cbe422565eb8459. --- diff --git a/tests/system/framework/hosts/base.py b/tests/system/framework/hosts/base.py index 9146c7d4e..764c15aff 100644 --- a/tests/system/framework/hosts/base.py +++ b/tests/system/framework/hosts/base.py @@ -47,7 +47,6 @@ class BaseLinuxHost(MultihostHost[ShadowMultihostDomain]): self._distro_name: str = "unknown" self._distro_major: int = 0 self._distro_minor: int = 0 - self._revision: int = 0 def _distro_information(self): """ @@ -61,13 +60,9 @@ class BaseLinuxHost(MultihostHost[ShadowMultihostDomain]): self._distro_name = self._os_release["NAME"] if "VERSION_ID" not in self._os_release: return - if self._os_release["VERSION_ID"].count(".") == 2: - self._distro_major = int(self._os_release["VERSION_ID"].split(".")[0]) - self._distro_minor = int(self._os_release["VERSION_ID"].split(".")[1]) - self._revision = int(self._os_release["VERSION_ID"].split(".")[2]) - elif self._os_release["VERSION_ID"].count(".") == 1: - self._distro_major = int(self._os_release["VERSION_ID"].split(".")[0]) - self._distro_minor = int(self._os_release["VERSION_ID"].split(".")[1]) + if "." in self._os_release["VERSION_ID"]: + self._distro_major = int(self._os_release["VERSION_ID"].split(".", maxsplit=1)[0]) + self._distro_minor = int(self._os_release["VERSION_ID"].split(".", maxsplit=1)[1]) else: self._distro_major = int(self._os_release["VERSION_ID"])