From c95e337abfa23ee0df0db75fd3184c686a078f67 Mon Sep 17 00:00:00 2001 From: Sweta Yadav <106366788+swetayadav1@users.noreply.github.com> Date: Wed, 21 Sep 2022 14:35:37 +0530 Subject: [PATCH] NXDRIVE-2790: Mac version format issue (#3609) NXDRIVE-2790: Mac version format issue --- docs/changes/5.3.0.md | 1 + nxdrive/metrics/utils.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changes/5.3.0.md b/docs/changes/5.3.0.md index 235ffcbd49..b841a107bc 100644 --- a/docs/changes/5.3.0.md +++ b/docs/changes/5.3.0.md @@ -30,6 +30,7 @@ Release date: `2022-xx-xx` ## Tests - [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2): +- [NXDRIVE-2790](https://jira.nuxeo.com/browse/NXDRIVE-2790): Mac version format issue ## Docs diff --git a/nxdrive/metrics/utils.py b/nxdrive/metrics/utils.py index 7c7d54cbc8..53dcab21de 100644 --- a/nxdrive/metrics/utils.py +++ b/nxdrive/metrics/utils.py @@ -1,4 +1,5 @@ import platform +import re from functools import lru_cache from typing import Tuple @@ -17,7 +18,11 @@ def _get_current_os_details() -> Tuple[str, str, str]: """ if MAC: name = "macOS" - ver_full = platform.mac_ver()[0] # 10.15.3 + mac_ver = platform.mac_ver()[0] + if re.fullmatch(r"\d{2}\.\d{1,2}\.\d{1,2}$", mac_ver): + ver_full = mac_ver # 10.15.3 + else: + ver_full = mac_ver + ".0" elif WINDOWS: name = "Windows" ver_full = platform.win32_ver()[1] # 10.0.19041