1
0
mirror of https://github.com/django/django.git synced 2025-10-31 01:25:32 +00:00

Fixed #17491 -- Honored the version number format expected by distutils. Fixed #11236 too.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17351 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Aymeric Augustin
2012-01-07 19:05:29 +00:00
parent aa5d307da6
commit f46003559c
2 changed files with 20 additions and 8 deletions

View File

@@ -14,3 +14,17 @@ def get_version():
if svn_rev != u'SVN-unknown':
version = "%s %s" % (version, svn_rev)
return version
def get_distutils_version():
# Distutils expects a version number formatted as major.minor[.patch][sub]
parts = 5
if VERSION[3] == 'final':
parts = 3
if VERSION[2] == 0:
parts = 2
version = VERSION[:parts]
version = [str(x)[0] for x in version] # ['1', '4', '0', 'a', '1']
if parts > 2:
version[2:] = [''.join(version[2:])] # ['1', '4', '0a1']
version = '.'.join(version) # '1.4.0a1'
return version