diff --git a/pleskdistup/common/src/version.py b/pleskdistup/common/src/version.py index 1c189f2..3a83a89 100644 --- a/pleskdistup/common/src/version.py +++ b/pleskdistup/common/src/version.py @@ -30,6 +30,11 @@ def _extract_no_build(self, version: str) -> None: self.build = "" self.major, self.minor, self.patch, self.distro, self.arch = version.split(".") + def _remove_prefix(self, version: str) -> str: + while not version[0].isdigit(): + version = version.split("-", 1)[-1] + return version + def __init__(self, version: str): """Initialize a KernelVersion object.""" self.major = "0" @@ -39,6 +44,7 @@ def __init__(self, version: str): self.distro = "" self.arch = "" + version = self._remove_prefix(version) if "-" in version: self._extract_with_build(version) else: @@ -109,6 +115,7 @@ def __init__(self, to_extract: str): if to_extract.startswith("plesk-php"): self._extract_from_plesk_package(to_extract) + elif to_extract.startswith("PHP "): self._extract_from_desc(to_extract) elif to_extract[0].isdigit():