From c91fc8588f09ccd1e56aadac3fca9cb2cfb48bd0 Mon Sep 17 00:00:00 2001 From: Helen Kershaw Date: Thu, 26 Mar 2026 13:42:28 -0600 Subject: [PATCH] find cime version in tag, allowing prefix or suffixes fixes #36 --- visualCaseGen/cime_interface.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/visualCaseGen/cime_interface.py b/visualCaseGen/cime_interface.py index 43c326e..30b3c15 100644 --- a/visualCaseGen/cime_interface.py +++ b/visualCaseGen/cime_interface.py @@ -118,13 +118,10 @@ def _check_cime_compatibility(self): ).decode("utf-8").strip() # determine cime version - assert cime_git_tag.startswith("cime"), f"Invalid cime git tag: {cime_git_tag}" - cime_version = cime_git_tag[4:] - assert len(cime_version.split(".")) == 3, f"Invalid cime version: {cime_version}" - cime_major, cime_minor, cime_patch = cime_version.split(".") - assert cime_major.isdigit() and cime_minor.isdigit() and cime_patch.isdigit(), \ - f"Invalid cime version (non-numeric): {cime_version}" - cime_major = int(cime_major); cime_minor = int(cime_minor); cime_patch = int(cime_patch) + match = re.search(r"cime(\d+)\.(\d+)\.(\d+)", cime_git_tag) + assert match, f"Invalid cime git tag: {cime_git_tag}" + + cime_major, cime_minor, cime_patch = map(int, match.groups()) # check cime version compatibility assert cime_major == 6, f"Unsupported major version: {cime_major} in cime version: {cime_version}"