Ticket #17491: 17491.patch

File 17491.patch, 1.9 KB (added by Aymeric Augustin, 13 years ago)
  • setup.py

     
    1717        self.set_undefined_options('install', ('install_lib', 'install_dir'))
    1818        install_data.finalize_options(self)
    1919
    20 if sys.platform == "darwin": 
    21     cmdclasses = {'install_data': osx_install_data} 
    22 else: 
    23     cmdclasses = {'install_data': install_data} 
     20if sys.platform == "darwin":
     21    cmdclasses = {'install_data': osx_install_data}
     22else:
     23    cmdclasses = {'install_data': install_data}
    2424
    2525def fullsplit(path, result=None):
    2626    """
     
    6666        file_info[0] = '\\PURELIB\\%s' % file_info[0]
    6767
    6868# Dynamically calculate the version based on django.VERSION.
    69 version = __import__('django').get_version()
    70 if u'SVN' in version:
    71     version = ' '.join(version.split(' ')[:-1])
     69version = __import__('django').get_distutils_version()
    7270
    7371setup(
    7472    name = "Django",
    75     version = version.replace(' ', '-'),
     73    version = version,
    7674    url = 'http://www.djangoproject.com/',
    7775    author = 'Django Software Foundation',
    7876    author_email = 'foundation@djangoproject.com',
  • django/__init__.py

     
    1414    if svn_rev != u'SVN-unknown':
    1515        version = "%s %s" % (version, svn_rev)
    1616    return version
     17
     18def get_distutils_version():
     19    # Distutils expects a version number formatted as major.minor[.patch][sub]
     20    parts = 5
     21    if VERSION[3] == 'final':
     22        parts = 3
     23        if VERSION[2] == 0:
     24            parts = 2
     25    version = VERSION[:parts]
     26    version = [str(x)[0] for x in version]      # ['1', '4', '0', 'a', '1']
     27    if parts > 2:
     28        version[2:] = [''.join(version[2:])]    # ['1', '4', '0a1']
     29    version = '.'.join(version)                 # '1.4.0a1'
     30    return version
Back to Top