Hello site
[auf_framonde.git] / eggs / Django-1.4.5-py2.7.egg / django / __init__.py
CommitLineData
01b54c21
MN
1VERSION = (1, 4, 5, 'final', 0)
2
3def get_version(version=None):
4 """Derives a PEP386-compliant version number from VERSION."""
5 if version is None:
6 version = VERSION
7 assert len(version) == 5
8 assert version[3] in ('alpha', 'beta', 'rc', 'final')
9
10 # Now build the two parts of the version number:
11 # main = X.Y[.Z]
12 # sub = .devN - for pre-alpha releases
13 # | {a|b|c}N - for alpha, beta and rc releases
14
15 parts = 2 if version[2] == 0 else 3
16 main = '.'.join(str(x) for x in version[:parts])
17
18 sub = ''
19 if version[3] == 'alpha' and version[4] == 0:
20 # At the toplevel, this would cause an import loop.
21 from django.utils.version import get_svn_revision
22 svn_revision = get_svn_revision()[4:]
23 if svn_revision != 'unknown':
24 sub = '.dev%s' % svn_revision
25
26 elif version[3] != 'final':
27 mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
28 sub = mapping[version[3]] + str(version[4])
29
30 return main + sub