2
0

setup.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from distutils.core import setup
  2. from distutils.command.install import INSTALL_SCHEMES
  3. import os
  4. import sys
  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. # Compile the list of packages available, because distutils doesn't have
  11. # an easy way to do this.
  12. packages, data_files = [], []
  13. root_dir = os.path.dirname(__file__)
  14. len_root_dir = len(root_dir)
  15. django_dir = os.path.join(root_dir, 'django')
  16. for dirpath, dirnames, filenames in os.walk(django_dir):
  17. # Ignore dirnames that start with '.'
  18. for i, dirname in enumerate(dirnames):
  19. if dirname.startswith('.'): del dirnames[i]
  20. if '__init__.py' in filenames:
  21. package = dirpath[len_root_dir:].lstrip('/').replace('/', '.')
  22. packages.append(package)
  23. else:
  24. data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
  25. # Small hack for working with bdist_wininst.
  26. # See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
  27. if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst':
  28. for file_info in data_files:
  29. file_info[0] = '/PURELIB/%s' % file_info[0]
  30. # Dynamically calculate the version based on django.VERSION.
  31. version = "%d.%d-%s" % (__import__('django').VERSION)
  32. setup(
  33. name = "Django",
  34. version = version,
  35. url = 'http://www.djangoproject.com/',
  36. author = 'Lawrence Journal-World',
  37. author_email = 'holovaty@gmail.com',
  38. description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
  39. packages = packages,
  40. data_files = data_files,
  41. scripts = ['django/bin/django-admin.py'],
  42. )