Django

Code

Show
Ignore:
Timestamp:
04/05/07 11:17:35 (2 years ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Merged to [4934].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/setup.py

    r4695 r4935  
    33import os 
    44import sys 
     5 
     6def fullsplit(path, result=None): 
     7    """ 
     8    Split a pathname into components (the opposite of os.path.join) in a 
     9    platform-neutral way. 
     10    """ 
     11    if result is None: 
     12        result = [] 
     13    head, tail = os.path.split(path) 
     14    if head == '': 
     15        return [tail] + result 
     16    if head == path: 
     17        return result 
     18    return fullsplit(head, [tail] + result) 
    519 
    620# Tell distutils to put the data_files in platform-specific installation 
     
    1428packages, data_files = [], [] 
    1529root_dir = os.path.dirname(__file__) 
    16 len_root_dir = len(root_dir) 
    1730django_dir = os.path.join(root_dir, 'django') 
     31pieces = fullsplit(root_dir) 
     32if pieces[-1] == '': 
     33    len_root_dir = len(pieces) - 1 
     34else: 
     35    len_root_dir = len(pieces) 
    1836 
    1937for dirpath, dirnames, filenames in os.walk(django_dir): 
     
    2240        if dirname.startswith('.'): del dirnames[i] 
    2341    if '__init__.py' in filenames: 
    24         package = dirpath[len_root_dir:].lstrip('/').replace('/', '.') 
    25         packages.append(package) 
    26     else: 
     42        packages.append('.'.join(fullsplit(dirpath)[len_root_dir:])) 
     43    elif filenames: 
    2744        data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) 
    2845 
    29 # Small hack for working with bdist_wininst. 
    30 # See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html 
    31 if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst': 
    32     for file_info in data_files: 
    33         file_info[0] = '/PURELIB/%s' % file_info[0] 
    34  
    3546# Dynamically calculate the version based on django.VERSION. 
    36 version = "%d.%d-%s" % (__import__('django').VERSION) 
     47version_tuple = __import__('django').VERSION 
     48if version_tuple[2] is not None: 
     49    version = "%d.%d_%s" % version_tuple 
     50else: 
     51    version = "%d.%d" % version_tuple[:2] 
    3752 
    3853setup(