[9006] | 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 |
|
---|
| 8 | def fullsplit(path, result=None):
|
---|
| 9 | """
|
---|
| 10 | Split a pathname into components (the opposite of os.path.join) in a
|
---|
| 11 | platform-neutral way.
|
---|
| 12 | """
|
---|
| 13 | if result is None:
|
---|
| 14 | result = []
|
---|
| 15 | head, tail = os.path.split(path)
|
---|
| 16 | if head == '':
|
---|
| 17 | return [tail] + result
|
---|
| 18 | if head == path:
|
---|
| 19 | return result
|
---|
| 20 | return fullsplit(head, [tail] + result)
|
---|
| 21 |
|
---|
| 22 | # Tell distutils to put the data_files in platform-specific installation
|
---|
| 23 | # locations. See here for an explanation:
|
---|
| 24 | # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
|
---|
| 25 | for scheme in INSTALL_SCHEMES.values():
|
---|
| 26 | scheme['data'] = scheme['purelib']
|
---|
| 27 |
|
---|
| 28 | # Compile the list of packages available, because distutils doesn't have
|
---|
| 29 | # an easy way to do this.
|
---|
| 30 | packages, data_files = [], []
|
---|
| 31 | root_dir = os.path.dirname(__file__)
|
---|
| 32 | extensions_dir = os.path.join(root_dir, 'django_extensions')
|
---|
| 33 | pieces = fullsplit(root_dir)
|
---|
| 34 | if pieces[-1] == '':
|
---|
| 35 | len_root_dir = len(pieces) - 1
|
---|
| 36 | else:
|
---|
| 37 | len_root_dir = len(pieces)
|
---|
| 38 |
|
---|
| 39 | for dirpath, dirnames, filenames in os.walk(extensions_dir):
|
---|
| 40 | # Ignore dirnames that start with '.'
|
---|
| 41 | for i, dirname in enumerate(dirnames):
|
---|
| 42 | if dirname.startswith('.'):
|
---|
| 43 | del dirnames[i]
|
---|
| 44 | #if 'conf' in dirpath:
|
---|
| 45 | # print dirpath
|
---|
| 46 | if '__init__.py' in filenames and not 'conf' in dirpath:
|
---|
| 47 | packages.append('.'.join(fullsplit(dirpath)[len_root_dir:]))
|
---|
| 48 | elif filenames:
|
---|
| 49 | data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
---|
| 50 |
|
---|
| 51 | version = __import__('django_extensions').__version__
|
---|
| 52 |
|
---|
| 53 | setup(
|
---|
| 54 | name = 'django-extensions',
|
---|
| 55 | version = version,
|
---|
| 56 | description = "Extensions for Django",
|
---|
| 57 | long_description = """django-extensions bundles several useful
|
---|
| 58 | additions for Django projects. See the project page for more information:
|
---|
| 59 | http://code.google.com/p/django-command-extensions/""",
|
---|
| 60 | author = 'Michael Trier',
|
---|
| 61 | author_email = 'mtrier@gmail.com',
|
---|
| 62 | url = 'http://code.google.com/p/django-command-extensions/',
|
---|
| 63 | license = 'New BSD License',
|
---|
| 64 | platforms = ['any'],
|
---|
| 65 | packages = packages,
|
---|
| 66 | data_files = data_files,
|
---|
| 67 | classifiers = ['Development Status :: 4 - Beta',
|
---|
| 68 | 'Environment :: Web Environment',
|
---|
| 69 | 'Framework :: Django',
|
---|
| 70 | 'Intended Audience :: Developers',
|
---|
| 71 | 'License :: OSI Approved :: BSD License',
|
---|
| 72 | 'Operating System :: OS Independent',
|
---|
| 73 | 'Programming Language :: Python',
|
---|
| 74 | 'Topic :: Utilities'],
|
---|
| 75 | )
|
---|
| 76 |
|
---|