From 0dc6673a1f710fd844b7181a4d9a73e37d528331 Mon Sep 17 00:00:00 2001 From: miro Date: Thu, 12 Sep 2024 02:39:54 +0100 Subject: [PATCH] fix:version_file automations messed up version.py file --- ovos_core/version.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/ovos_core/version.py b/ovos_core/version.py index 95f7bcf806ef..38e9a9eda27f 100644 --- a/ovos_core/version.py +++ b/ovos_core/version.py @@ -3,4 +3,33 @@ VERSION_MINOR = 0 VERSION_BUILD = 8 VERSION_ALPHA = 132 -# END_VERSION_BLOCK \ No newline at end of file +# END_VERSION_BLOCK + +# for compat with old imports +OVOS_VERSION_MAJOR = VERSION_MAJOR +OVOS_VERSION_MINOR = VERSION_MINOR +OVOS_VERSION_BUILD = VERSION_BUILD +OVOS_VERSION_ALPHA = VERSION_ALPHA + +OVOS_VERSION_TUPLE = (VERSION_MAJOR, + VERSION_MINOR, + VERSION_BUILD) +OVOS_VERSION_STR = '.'.join(map(str, OVOS_VERSION_TUPLE)) + + +class VersionManager: + @staticmethod + def get(): + return {"OpenVoiceOSVersion": OVOS_VERSION_STR} + + +def check_version(version_string): + """ + Check if current version is equal or higher than the + version string provided to the function + + Args: + version_string (string): version string ('Major.Minor.Build') + """ + version_tuple = tuple(map(int, version_string.split('.'))) + return OVOS_VERSION_TUPLE >= version_tuple \ No newline at end of file