Fix CargoSemVer.eval_ KIND_GTE and KIND_LTE comparisons
Just make use of KIND_GT/KIND_LT and KIND_SHORTEQ Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
This commit is contained in:
parent
1869f5a7e0
commit
6a5931b7dd
1 changed files with 4 additions and 6 deletions
|
@ -166,9 +166,8 @@ class CargoSemVer:
|
|||
)
|
||||
elif op == CargoSemVer.KIND_GTE:
|
||||
return (
|
||||
(v1.major >= v2.major)
|
||||
or (v1.major == v2.major and v1.minor >= v2.minor)
|
||||
or (v1.major == v2.major and v1.minor == v2.minor and v1.patch >= v2.patch)
|
||||
CargoSemVer.eval_(v1, CargoSemVer.KIND_GT, v2)
|
||||
or CargoSemVer.eval_(v1, CargoSemVer.KIND_SHORTEQ, v2)
|
||||
)
|
||||
elif op == CargoSemVer.KIND_LT:
|
||||
return (
|
||||
|
@ -178,9 +177,8 @@ class CargoSemVer:
|
|||
)
|
||||
elif op == CargoSemVer.KIND_LTE:
|
||||
return (
|
||||
(v1.major <= v2.major)
|
||||
or (v1.major == v2.major and v1.minor <= v2.minor)
|
||||
or (v1.major == v2.major and v1.minor == v2.minor and v1.patch <= v2.patch)
|
||||
CargoSemVer.eval_(v1, CargoSemVer.KIND_LT, v2)
|
||||
or CargoSemVer.eval_(v1, CargoSemVer.KIND_SHORTEQ, v2)
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"Cannot evaluate operator: {op}")
|
||||
|
|
Loading…
Reference in a new issue