2 VersionTuple
= (2,0,1,'final',0)
4 MinCompatibleVersion
= '2.0rc6'
5 MinCompatibleVersionTuple
= (2,0,0,'candidate',6)
8 def convertVersionStringToTuple(s
):
13 num
, releaseTypeSubNum
= s
.split('a')
16 num
, releaseTypeSubNum
= s
.split('b')
18 elif s
.find('rc')!=-1:
19 num
, releaseTypeSubNum
= s
.split('rc')
20 releaseType
= 'candidate'
24 for i
in range(len(num
)):
25 versionNum
[i
] = int(num
[i
])
28 releaseTypeSubNum
= int(releaseTypeSubNum
)
30 return tuple(versionNum
+[releaseType
,releaseTypeSubNum
])
33 if __name__
== '__main__':
34 c
= convertVersionStringToTuple
42 assert c('0.9.19b1') < c('0.9.19')
43 assert c('0.9b1') < c('0.9.19')
45 assert c('2.0a2') > c('2.0a1')
46 assert c('2.0b1') > c('2.0a2')
47 assert c('2.0b2') > c('2.0b1')
48 assert c('2.0b2') == c('2.0b2')
50 assert c('2.0rc1') > c('2.0b1')
51 assert c('2.0rc2') > c('2.0rc1')
52 assert c('2.0rc2') > c('2.0b1')
54 assert c('2.0') > c('2.0a1')
55 assert c('2.0') > c('2.0b1')
56 assert c('2.0') > c('2.0rc1')
57 assert c('2.0.1') > c('2.0')
58 assert c('2.0rc1') > c('2.0b1')