MCPcopy
hub / github.com/django/django / get_version

Function get_version

django/utils/version.py:24–45  ·  view source on GitHub ↗

Return a PEP 440-compliant version number from VERSION.

(version=None)

Source from the content-addressed store, hash-verified

22
23
24def get_version(version=None):
25 """Return a PEP 440-compliant version number from VERSION."""
26 version = get_complete_version(version)
27
28 # Now build the two parts of the version number:
29 # main = X.Y[.Z]
30 # sub = .devN - for pre-alpha releases
31 # | {a|b|rc}N - for alpha, beta, and rc releases
32
33 main = get_main_version(version)
34
35 sub = ""
36 if version[3] == "alpha" and version[4] == 0:
37 git_changeset = get_git_changeset()
38 if git_changeset:
39 sub = ".dev%s" % git_changeset
40
41 elif version[3] != "final":
42 mapping = {"alpha": "a", "beta": "b", "rc": "rc"}
43 sub = mapping[version[3]] + str(version[4])
44
45 return main + sub
46
47
48def get_main_version(version=None):

Callers 9

__init__.pyFile · 0.90
get_traceback_dataMethod · 0.90
as_stringMethod · 0.90
test_versionMethod · 0.90
test_developmentMethod · 0.90
test_releasesMethod · 0.90
django_releaseFunction · 0.90

Calls 3

get_complete_versionFunction · 0.85
get_main_versionFunction · 0.85
get_git_changesetFunction · 0.85