Skip to content

Commit e430ab8

Browse files
committed
refactor: enhance compare versions
Signed-off-by: thxCode <[email protected]>
1 parent 696d00f commit e430ab8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

gpustack_runtime/deployer/__utils__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ def compare_versions(v1: str | None, v2: str | None) -> int:
338338
if v2 is None:
339339
v2 = ""
340340

341+
v1 = v1.removeprefix("v")
342+
v2 = v2.removeprefix("v")
343+
341344
if v1 == v2:
342345
return 0
343346

tests/gpustack_runtime/deployer/fixtures/test_compare_versions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,13 @@
7878
"v2": "1.2.3.post1"
7979
},
8080
-1
81+
],
82+
[
83+
"v1.2.3 = 1.2.3",
84+
{
85+
"v1": "v1.2.3",
86+
"v2": "1.2.3"
87+
},
88+
0
8189
]
8290
]

0 commit comments

Comments
 (0)