| 1 |
from distutils.core import setup |
|---|
| 2 |
from distutils.command.install import INSTALL_SCHEMES |
|---|
| 3 |
import os |
|---|
| 4 |
|
|---|
| 5 |
# Tell distutils to put the data_files in platform-specific installation |
|---|
| 6 |
# locations. See here for an explanation: |
|---|
| 7 |
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb |
|---|
| 8 |
for scheme in INSTALL_SCHEMES.values(): |
|---|
| 9 |
scheme['data'] = scheme['purelib'] |
|---|
| 10 |
|
|---|
| 11 |
# Compile the list of packages available, because distutils doesn't have |
|---|
| 12 |
# an easy way to do this. |
|---|
| 13 |
packages, data_files = [], [] |
|---|
| 14 |
root_dir = os.path.dirname(__file__) |
|---|
| 15 |
len_root_dir = len(root_dir) |
|---|
| 16 |
django_dir = os.path.join(root_dir, 'django') |
|---|
| 17 |
|
|---|
| 18 |
for dirpath, dirnames, filenames in os.walk(django_dir): |
|---|
| 19 |
# Ignore dirnames that start with '.' |
|---|
| 20 |
for i, dirname in enumerate(dirnames): |
|---|
| 21 |
if dirname.startswith('.'): del dirnames[i] |
|---|
| 22 |
if '__init__.py' in filenames: |
|---|
| 23 |
package = dirpath[len_root_dir:].lstrip('/').replace('/', '.') |
|---|
| 24 |
packages.append(package) |
|---|
| 25 |
else: |
|---|
| 26 |
data_files.append((dirpath, [os.path.join(dirpath, f) for f in filenames])) |
|---|
| 27 |
|
|---|
| 28 |
# Dynamically calculate the version based on django.VERSION. |
|---|
| 29 |
version = "%d.%d-%s" % (__import__('django').VERSION) |
|---|
| 30 |
|
|---|
| 31 |
setup( |
|---|
| 32 |
name = "Django", |
|---|
| 33 |
version = version, |
|---|
| 34 |
url = 'http://www.djangoproject.com/', |
|---|
| 35 |
author = 'Lawrence Journal-World', |
|---|
| 36 |
author_email = 'holovaty@gmail.com', |
|---|
| 37 |
description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.', |
|---|
| 38 |
packages = packages, |
|---|
| 39 |
data_files = data_files, |
|---|
| 40 |
scripts = ['django/bin/django-admin.py'], |
|---|
| 41 |
) |
|---|