summaryrefslogtreecommitdiff
path: root/django/__init__.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-01-07 19:05:29 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-01-07 19:05:29 +0000
commitf46003559cc59d27df7a4926001fd10b84f4ab22 (patch)
tree220a0a0805bba9e8dec985e3d4e7c01e6814abad /django/__init__.py
parentaa5d307da65cb0933172c9640efeb44d94323be5 (diff)
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
Diffstat (limited to 'django/__init__.py')
-rw-r--r--django/__init__.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/django/__init__.py b/django/__init__.py
index e790da37f3..6467c033bb 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -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