You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LooseVersion() can't compare JUNOS -S train. ex 20.4R3.8 vs 20.4R3-S4.8
So, I use the following function. but It's not portable in the future.
def compare_version(left, right):
"""compare version left and right
:param left: version left string, ex 18.4R3-S9.2,
:param right: version right string, ex 18.4R3-S10
:return: 1 if left > right
0 if left == right
-1 if left < right
"""
if left is None or right is None:
return None
if LooseVersion(left.replace("-S", "00")) > LooseVersion(right.replace("-S", "00")):
return 1
if LooseVersion(left.replace("-S", "00")) < LooseVersion(right.replace("-S", "00")):
return -1
return 0
Could you create official version compare function?
Thank you.
The text was updated successfully, but these errors were encountered:
I need a official version compare function.
I am using distutils LooseVersion() in my PyEz based tools ( https://github.com/shigechika/junos-update )
But LooseVersion() has problems.
So, I use the following function. but It's not portable in the future.
Could you create official version compare function?
Thank you.
The text was updated successfully, but these errors were encountered: