##// END OF EJS Templates
remove unused NumericalVersion
MinRK -
Show More
@@ -22,39 +22,6 b' from distutils.version import LooseVersion'
22 # Code
22 # Code
23 #-----------------------------------------------------------------------------
23 #-----------------------------------------------------------------------------
24
24
25 class NumericalVersion(LooseVersion):
26 """A version of LooseVersion that is *always* comparable
27
28 String elements (of any kind!) are interpreted as infinite.
29 Since these are generally only on development branches,
30 that is fairly safe, even though technically 1.0a1 should be less than 1.0.
31 """
32 def parse (self, vstring):
33 # I've given up on thinking I can reconstruct the version string
34 # from the parsed tuple -- so I just store the string here for
35 # use by __str__
36 self.vstring = vstring
37 components = filter(lambda x: x and x != '.',
38 self.component_re.split(vstring))
39 for i in range(len(components)):
40 try:
41 components[i] = int(components[i])
42 except ValueError:
43 # this is the only change
44 components[i] = float('inf')
45
46 self.version = components
47
48 def version_tuple(vs):
49 """Return a tuple of numbers from a version string.
50
51 'dev' 'a', 'etc' are transformed to float('inf'),
52 so they will always compare positively to any
53 regular integer element.
54 """
55 return tuple(NumericalVersion(vs).version)
56
57 #
58 def check_version(v, check):
25 def check_version(v, check):
59 """check version string v >= check
26 """check version string v >= check
60
27
@@ -66,4 +33,4 b' def check_version(v, check):'
66 return LooseVersion(v) >= LooseVersion(check)
33 return LooseVersion(v) >= LooseVersion(check)
67 except TypeError:
34 except TypeError:
68 return True
35 return True
69 No newline at end of file
36
General Comments 0
You need to be logged in to leave comments. Login now