Skip to content

Commit

Permalink
Add version comparison tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Rufflewind committed Jun 3, 2018
1 parent c1d0d32 commit e9debc1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/vercmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import sys

def parse_version(s):
return tuple(map(int, s.split(".")))

def cmp(x, y):
return (x > y) - (x < y)

print(cmp(parse_version(sys.argv[1]), parse_version(sys.argv[2])))

0 comments on commit e9debc1

Please sign in to comment.