|
1 VERSION = (0, 0, 30, "final", 0) |
|
2 |
|
3 VERSION_STR = ".".join(map(lambda i:"%02d" % (i,), VERSION[:2])) |
|
4 |
|
5 ### |
|
6 # https://github.com/django/django/blob/1.9.1/django/utils/version.py |
|
7 # |
|
8 def get_version(version=None): |
|
9 "Returns a PEP 440-compliant version number from VERSION." |
|
10 if not version: |
|
11 version = VERSION |
|
12 version = get_complete_version(version) |
|
13 |
|
14 # Now build the two parts of the version number: |
|
15 # main = X.Y[.Z] |
|
16 # sub = .devN - for pre-alpha releases |
|
17 # | {a|b|rc}N - for alpha, beta, and rc releases |
|
18 |
|
19 main = get_main_version(version) |
|
20 |
|
21 sub = '' |
|
22 if version[3] == 'alpha' and version[4] == 0: |
|
23 sub = '.dev' |
|
24 |
|
25 elif version[3] != 'final': |
|
26 mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'rc'} |
|
27 sub = mapping[version[3]] + str(version[4]) |
|
28 |
|
29 return str(main + sub) |
|
30 |
|
31 def get_complete_version(version): |
|
32 """ |
|
33 then checks for correctness of the tuple provided. |
|
34 """ |
|
35 assert len(version) == 5 |
|
36 assert version[3] in ('alpha', 'beta', 'rc', 'final') |
|
37 |
|
38 return version |
|
39 |
|
40 def get_main_version(version=None): |
|
41 "Returns main version (X.Y[.Z]) from VERSION." |
|
42 version = get_complete_version(version) |
|
43 parts = 2 if version[2] == 0 else 3 |
|
44 return '.'.join(str(x) for x in version[:parts]) |
|
45 |
|
46 __version__ = get_version(VERSION) |
|
47 |
|
48 default_app_config = 'iconolab_episteme.apps.IconolabEpistemeApp' |