Changed a couple of old-style validators to remove some deprecation warnings
[django.git] / setup.py
blob081cdb4c4b3c65056d32ff48c12c70f442818321
1 from distutils.core import setup
2 from distutils.command.install import INSTALL_SCHEMES
3 import os
4 import sys
6 def 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)
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 if root_dir != '':
31 os.chdir(root_dir)
32 django_dir = 'django'
34 for dirpath, dirnames, filenames in os.walk(django_dir):
35 # Ignore dirnames that start with '.'
36 for i, dirname in enumerate(dirnames):
37 if dirname.startswith('.'): del dirnames[i]
38 if '__init__.py' in filenames:
39 packages.append('.'.join(fullsplit(dirpath)))
40 elif filenames:
41 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
43 # Dynamically calculate the version based on django.VERSION.
44 version_tuple = __import__('django').VERSION
45 if version_tuple[2] is not None:
46 version = "%d.%d_%s" % version_tuple
47 else:
48 version = "%d.%d" % version_tuple[:2]
50 setup(
51 name = "Django",
52 version = version,
53 url = 'http://www.djangoproject.com/',
54 author = 'Django Software Foundation',
55 author_email = 'foundation@djangoproject.com',
56 description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
57 packages = packages,
58 data_files = data_files,
59 scripts = ['django/bin/django-admin.py'],