Skip to content
Snippets Groups Projects
Commit e6c5eea6 authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

finish cleanup

parent 22f740cc
No related branches found
No related tags found
2 merge requests!1706merge 2.8.4 to main,!1684fix default determination to handle symlinked casa installs
Pipeline #16128 passed
...@@ -58,25 +58,16 @@ def casa_version_from_path(path: str) -> str: ...@@ -58,25 +58,16 @@ def casa_version_from_path(path: str) -> str:
# Defaults # Defaults
casa_version, pipeline_version = "unknown", "default" casa_version, pipeline_version = "unknown", "default"
def check_regex(regex: str, path_str: str) -> re.Match[str] | None: cv_search = re.search(CASA_VERSION_REGEX, path)
"""
check casa paths against version and pipeline regexes
:param regex:
:param path_str:
:return:
"""
return re.search(regex, path_str)
cv_search = check_regex(CASA_VERSION_REGEX, path)
if cv_search is None: if cv_search is None:
# this is probably a default link, make sure we use the actual version path # this is probably a default link, make sure we use the actual version path
path2 = pathlib.Path(path) path2 = pathlib.Path(path)
if path2.is_symlink(): if path2.is_symlink():
path = str(path2.readlink()) path = str(path2.readlink())
cv_search = check_regex(CASA_VERSION_REGEX, path) cv_search = re.search(CASA_VERSION_REGEX, path)
pv_search = check_regex(PIPELINE_VERSION_REGEX, path) pv_search = re.search(PIPELINE_VERSION_REGEX, path)
if cv_search: if cv_search:
# Replace last '-' in the directory name with '.' to match versions stored in the database # Replace last '-' in the directory name with '.' to match versions stored in the database
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment