setup.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. """
  2. Based on Django REST Framework's ``setup.py``.
  3. """
  4. import os
  5. from setuptools import setup
  6. from rest_framework_bulk import __version__, __author__
  7. def get_packages(package):
  8. """
  9. Return root package and all sub-packages.
  10. """
  11. return [dirpath
  12. for dirpath, dirnames, filenames in os.walk(package)
  13. if os.path.exists(os.path.join(dirpath, '__init__.py'))]
  14. def get_package_data(package):
  15. """
  16. Return all files under the root package, that are not in a
  17. package themselves.
  18. """
  19. walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
  20. for dirpath, dirnames, filenames in os.walk(package)
  21. if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
  22. filepaths = []
  23. for base, filenames in walk:
  24. filepaths.extend([os.path.join(base, filename)
  25. for filename in filenames])
  26. if filepaths:
  27. return {package: filepaths}
  28. else:
  29. return None
  30. def read(fname):
  31. return open(os.path.join(os.path.dirname(__file__), fname)).read()
  32. setup(
  33. name='djangorestframework-bulk',
  34. version=__version__,
  35. author=__author__,
  36. author_email='miroslav@miki725.com',
  37. description='Django REST Framework bulk CRUD view mixins',
  38. long_description=read('README.rst') + read('LICENSE.rst'),
  39. url='https://github.com/miki725/django-rest-framework-bulk',
  40. license='MIT',
  41. keywords='django',
  42. packages=get_packages('rest_framework_bulk'),
  43. data_files=get_package_data('rest_framework_bulk'),
  44. install_requires=[
  45. 'django',
  46. 'djangorestframework',
  47. ],
  48. classifiers=[
  49. 'Development Status :: 3 - Alpha',
  50. 'Framework :: Django',
  51. 'Intended Audience :: Developers',
  52. 'Operating System :: OS Independent',
  53. 'Programming Language :: Python',
  54. 'Programming Language :: Python :: 3',
  55. 'Topic :: Utilities',
  56. 'Topic :: Internet :: WWW/HTTP',
  57. 'License :: OSI Approved :: MIT License',
  58. ],
  59. )