diff --git a/tests/unit_tests/common/test_ucsversion.py b/tests/unit_tests/common/test_ucsversion.py index f898e3dd..d2afcb24 100644 --- a/tests/unit_tests/common/test_ucsversion.py +++ b/tests/unit_tests/common/test_ucsversion.py @@ -120,6 +120,7 @@ def test_version_parsing(self): ("4.2(0.175a)", {"major": "4", "minor": "2", "mr": "0", "patch": "a", "spin": None, "build": "175"}), ("4.2(1.2021052301)", {"major": "4", "minor": "2", "mr": "2", "patch": "a", "spin": None, "build": None}), ("4.2(1a.2021052301)", {"major": "4", "minor": "2", "mr": "1", "patch": "b", "spin": "2021052301", "build": None}), + ("4.3(6.250037)", {"major": "4", "minor": "3", "mr": "6", "patch": "z", "spin": "250037", "build": None}), ] for version_str, expected in test_cases: diff --git a/ucsmsdk/ucscoremeta.py b/ucsmsdk/ucscoremeta.py index 445d1b1a..7a939aa9 100644 --- a/ucsmsdk/ucscoremeta.py +++ b/ucsmsdk/ucscoremeta.py @@ -91,6 +91,18 @@ def __init__(self, version): if self._set_versions(match_obj): return + # handle spin builds "4.3(6.250037)" - short numeric spin build numbers (6-7 digits) + # e.g. 4.3(6.250037) is a spin build of 4.3(6x) branch, spin=250037 + # (1-5 digit numbers are handled by the first pattern above as patch/interim builds, + # 8+ digit date-like numbers are handled by the special builds pattern below) + match_pattern = re.compile(r"^(?P[1-9][0-9]{0,2})\." + r"(?P(([0-9])|([1-9][0-9]{0,1})))\(" + r"(?P(([0-9])|([1-9][0-9]{0,2})))\." + r"(?P[1-9][0-9]{5,6})\)$") + match_obj = re.match(match_pattern, version) + if self._set_versions(match_obj): + return + # handle de special builds "66.77(67.1582251418)" match_pattern = re.compile(r"^(?P[1-9][0-9]{0,2})\." r"(?P(([0-9])|([1-9][0-9]{0,2})))\("