setup.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. """
  2. Based entirely on Django's own ``setup.py``.
  3. """
  4. import os
  5. from distutils.command.install import INSTALL_SCHEMES
  6. from distutils.core import setup
  7. def fullsplit(path, result=None):
  8. """
  9. Split a pathname into components (the opposite of os.path.join) in a
  10. platform-neutral way.
  11. """
  12. if result is None:
  13. result = []
  14. head, tail = os.path.split(path)
  15. if head == '':
  16. return [tail] + result
  17. if head == path:
  18. return result
  19. 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']
  25. # Compile the list of packages available, because distutils doesn't have
  26. # an easy way to do this.
  27. packages, data_files = [], []
  28. root_dir = os.path.dirname(__file__)
  29. if root_dir != '':
  30. os.chdir(root_dir)
  31. extensions_dir = 'django_extensions'
  32. for dirpath, dirnames, filenames in os.walk(extensions_dir):
  33. # Ignore dirnames that start with '.'
  34. for i, dirname in enumerate(dirnames):
  35. if dirname.startswith('.'):
  36. del dirnames[i]
  37. if '__init__.py' in filenames:
  38. packages.append('.'.join(fullsplit(dirpath)))
  39. elif filenames:
  40. data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
  41. version = __import__('django_extensions').__version__
  42. setup(
  43. name = 'django-extensions',
  44. version = version,
  45. description = "Extensions for Django",
  46. long_description = """django-extensions bundles several useful
  47. additions for Django projects. See the project page for more information:
  48. http://code.google.com/p/django-command-extensions/""",
  49. author = 'Michael Trier',
  50. author_email = 'mtrier@gmail.com',
  51. url = 'http://code.google.com/p/django-command-extensions/',
  52. license = 'New BSD License',
  53. platforms = ['any'],
  54. packages = packages,
  55. data_files = data_files,
  56. classifiers = ['Development Status :: 4 - Beta',
  57. 'Environment :: Web Environment',
  58. 'Framework :: Django',
  59. 'Intended Audience :: Developers',
  60. 'License :: OSI Approved :: BSD License',
  61. 'Operating System :: OS Independent',
  62. 'Programming Language :: Python',
  63. 'Topic :: Utilities'],
  64. )