Package madrona
[hide private]

Source Code for Package madrona

 1  # from django.__init__ 
 2  from version import VERSION 
 3   
4 -def get_version(version=None):
5 """Derives a PEP386-compliant version number from VERSION.""" 6 if version is None: 7 version = VERSION 8 assert len(version) == 5 9 assert version[3] in ('alpha', 'beta', 'rc', 'final') 10 11 # Now build the two parts of the version number: 12 # main = X.Y[.Z] 13 # sub = .devN - for pre-alpha releases 14 # | {a|b|c}N - for alpha, beta and rc releases 15 parts = 2 if version[2] == 0 else 3 16 main = '.'.join(str(x) for x in version[:parts]) 17 sub = '' 18 19 if version[3] == 'alpha' and version[4] == 0: 20 sub = '.dev' 21 22 elif version[3] != 'final': 23 mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} 24 sub = mapping[version[3]] + str(version[4]) 25 26 return main + sub
27 28 __version__ = get_version(VERSION) 29