Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
7fb2cdcf
Commit
7fb2cdcf
authored
8 months ago
by
Daniel Nemergut
Committed by
Sam Kagan
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Made the version comparison a little more robust
parent
d7c3bc75
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/workspaces/workspaces/system/services/casa_matrix_service.py
+8
-4
8 additions, 4 deletions
...kspaces/workspaces/system/services/casa_matrix_service.py
with
8 additions
and
4 deletions
shared/workspaces/workspaces/system/services/casa_matrix_service.py
+
8
−
4
View file @
7fb2cdcf
...
...
@@ -45,6 +45,8 @@ CASA_VERSION_REGEX = r"[a-zA-Z\-]+([\d]+(\.[\d]+){2}(-[\d]+){0,1}).*"
PIPELINE_VERSION_REGEX
=
r
"
.*([\d]{4}(\.[\d]+){3}).*
"
EL_SUFFIX_REGEX
=
r
"
[\.\-]el[0-9]+$
"
IGNORE_REGEX
=
r
"
\.|\-
"
DEFAULT_CV
=
"
unknown
"
DEFAULT_PV
=
"
default
"
def
casa_version_from_path
(
path
:
str
)
->
str
:
...
...
@@ -57,7 +59,7 @@ def casa_version_from_path(path: str) -> str:
"""
# Defaults
casa_version
,
pipeline_version
=
"
unknown
"
,
"
default
"
casa_version
,
pipeline_version
=
DEFAULT_CV
,
DEFAULT_PV
cv_search
=
re
.
search
(
CASA_VERSION_REGEX
,
path
)
...
...
@@ -103,15 +105,17 @@ def versions_match(req_v: str, dir_v: str) -> bool:
:param dir_v: Version coming from a directory path
:return: True if the CASA+pipeline versions match
"""
req_cv
,
req_pv
=
req_v
.
split
(
"
|
"
)
dir_cv
,
dir_pv
=
dir_v
.
split
(
"
|
"
)
req_cv
=
req_v
.
split
(
"
|
"
)[
0
]
dir_cv
=
dir_v
.
split
(
"
|
"
)[
0
]
req_pv
=
req_v
.
split
(
"
|
"
)[
1
]
if
"
|
"
in
req_v
else
DEFAULT_PV
dir_pv
=
dir_v
.
split
(
"
|
"
)[
1
]
if
"
|
"
in
dir_v
else
DEFAULT_PV
# Ignore comparing '.' and '-' characters because they like to be used interchangeably
req_cv
=
re
.
sub
(
IGNORE_REGEX
,
""
,
req_cv
)
dir_cv
=
re
.
sub
(
IGNORE_REGEX
,
""
,
dir_cv
)
# Ignore comparing pipeline versions if they don't exist in the installed version's name
return
req_cv
==
dir_cv
and
(
dir_pv
==
"
default
"
or
req_pv
==
dir_pv
)
return
req_cv
==
dir_cv
and
(
dir_pv
==
DEFAULT_PV
or
req_pv
==
dir_pv
)
class
CasaMatrixService
(
CasaMatrixServiceIF
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment