root/galaxy-central/eggs/Cheetah-2.2.2-py2.6-macosx-10.6-universal-ucs2.egg/Cheetah/Version.py

リビジョン 3, 1.5 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1Version = '2.2.2'
2VersionTuple = (2, 2, 2,'final', 0)
3
4MinCompatibleVersion = '2.0rc6'
5MinCompatibleVersionTuple = (2,0,0,'candidate',6)
6
7####
8def convertVersionStringToTuple(s):
9    versionNum = [0,0,0]
10    releaseType = 'final'
11    releaseTypeSubNum = 0
12    if s.find('a')!=-1:
13        num, releaseTypeSubNum = s.split('a')
14        releaseType = 'alpha'
15    elif s.find('b')!=-1:
16        num, releaseTypeSubNum = s.split('b')
17        releaseType = 'beta'
18    elif s.find('rc')!=-1:
19        num, releaseTypeSubNum = s.split('rc')
20        releaseType = 'candidate'
21    else:
22        num = s
23    num = num.split('.')
24    for i in range(len(num)):
25        versionNum[i] = int(num[i])       
26    if len(versionNum)<3:
27        versionNum += [0]
28    releaseTypeSubNum = int(releaseTypeSubNum)
29   
30    return tuple(versionNum+[releaseType,releaseTypeSubNum])
31
32
33if __name__ == '__main__':
34    c = convertVersionStringToTuple
35    print c('2.0a1')
36    print c('2.0b1')
37    print c('2.0rc1')
38    print c('2.0')
39    print c('2.0.2')
40
41
42    assert c('0.9.19b1') < c('0.9.19')
43    assert c('0.9b1') < c('0.9.19')
44   
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')
49
50    assert c('2.0rc1') > c('2.0b1')
51    assert c('2.0rc2') > c('2.0rc1')
52    assert c('2.0rc2') > c('2.0b1')
53
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')
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。