1 from distutils
.core
import setup
2 from distutils
.command
.install
import INSTALL_SCHEMES
6 def fullsplit(path
, result
=None):
8 Split a pathname into components (the opposite of os.path.join) in a
13 head
, tail
= os
.path
.split(path
)
15 return [tail
] + result
18 return fullsplit(head
, [tail
] + result
)
20 # Tell distutils to put the data_files in platform-specific installation
21 # locations. See here for an explanation:
22 # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
23 for scheme
in INSTALL_SCHEMES
.values():
24 scheme
['data'] = scheme
['purelib']
26 # Compile the list of packages available, because distutils doesn't have
27 # an easy way to do this.
28 packages
, data_files
= [], []
29 root_dir
= os
.path
.dirname(__file__
)
30 django_dir
= os
.path
.join(root_dir
, 'django')
31 pieces
= fullsplit(root_dir
)
33 len_root_dir
= len(pieces
) - 1
35 len_root_dir
= len(pieces
)
37 for dirpath
, dirnames
, filenames
in os
.walk(django_dir
):
38 # Ignore dirnames that start with '.'
39 for i
, dirname
in enumerate(dirnames
):
40 if dirname
.startswith('.'): del dirnames
[i
]
41 if '__init__.py' in filenames
:
42 packages
.append('.'.join(fullsplit(dirpath
)[len_root_dir
:]))
44 data_files
.append([dirpath
, [os
.path
.join(dirpath
, f
) for f
in filenames
]])
46 # Dynamically calculate the version based on django.VERSION.
47 version_tuple
= __import__('django').VERSION
48 if version_tuple
[2] is not None:
49 version
= "%d.%d_%s" % version_tuple
51 version
= "%d.%d" % version_tuple
[:2]
56 url
= 'http://www.djangoproject.com/',
57 author
= 'Lawrence Journal-World',
58 author_email
= 'holovaty@gmail.com',
59 description
= 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
61 data_files
= data_files
,
62 scripts
= ['django/bin/django-admin.py'],