Author: aaugustin
Date: 2012-01-07 11:05:29 -0800 (Sat, 07 Jan 2012)
New Revision: 17351

Modified:
   django/trunk/django/__init__.py
   django/trunk/setup.py
Log:
Fixed #17491 -- Honored the version number format expected by distutils. Fixed 
#11236 too.


Modified: django/trunk/django/__init__.py
===================================================================
--- django/trunk/django/__init__.py     2012-01-07 18:48:12 UTC (rev 17350)
+++ django/trunk/django/__init__.py     2012-01-07 19:05:29 UTC (rev 17351)
@@ -14,3 +14,17 @@
     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

Modified: django/trunk/setup.py
===================================================================
--- django/trunk/setup.py       2012-01-07 18:48:12 UTC (rev 17350)
+++ django/trunk/setup.py       2012-01-07 19:05:29 UTC (rev 17351)
@@ -17,10 +17,10 @@
         self.set_undefined_options('install', ('install_lib', 'install_dir'))
         install_data.finalize_options(self)
 
-if sys.platform == "darwin": 
-    cmdclasses = {'install_data': osx_install_data} 
-else: 
-    cmdclasses = {'install_data': install_data} 
+if sys.platform == "darwin":
+    cmdclasses = {'install_data': osx_install_data}
+else:
+    cmdclasses = {'install_data': install_data}
 
 def fullsplit(path, result=None):
     """
@@ -66,13 +66,11 @@
         file_info[0] = '\\PURELIB\\%s' % file_info[0]
 
 # Dynamically calculate the version based on django.VERSION.
-version = __import__('django').get_version()
-if u'SVN' in version:
-    version = ' '.join(version.split(' ')[:-1])
+version = __import__('django').get_distutils_version()
 
 setup(
     name = "Django",
-    version = version.replace(' ', '-'),
+    version = version,
     url = 'http://www.djangoproject.com/',
     author = 'Django Software Foundation',
     author_email = '[email protected]',

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to