From 7caefb24859533df02a7062039c59c8058a86af4 Mon Sep 17 00:00:00 2001 From: Igor Kotrasinski Date: Sun, 17 Jun 2018 11:44:54 +0200 Subject: [PATCH] Use legacy versioning for client versions before 0.18.0 Signed-off-by: Igor Kotrasinski --- src/updater/base.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/updater/base.py b/src/updater/base.py index 2bf37fabe..f71b8e51a 100644 --- a/src/updater/base.py +++ b/src/updater/base.py @@ -28,6 +28,23 @@ class ReleaseType(Enum): @classmethod def get(cls, version): + if version < Version("0.18.0"): + return cls.legacy_versioning(version) + else: + return cls.new_versioning(version) + + @classmethod + def legacy_versioning(cls, version): + if version.minor % 2 == 1: + return cls.UNSTABLE + else: + if version.prerelease == (): + return cls.STABLE + else: + return cls.PRERELEASE + + @classmethod + def new_versioning(cls, version): if any(p in version.prerelease for p in ['alpha', 'beta']): return cls.UNSTABLE if any(p in version.prerelease for p in ['pre', 'rc']):