setup.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. def is_python_dir(dirpath):
  20. return (os.path.exists(os.path.join(dirpath, '__init__.py')) or
  21. '__pycache__' in dirpath)
  22. walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
  23. for dirpath, dirnames, filenames in os.walk(package)
  24. if not is_python_dir(dirpath)]
  25. filepaths = []
  26. for base, filenames in walk:
  27. filepaths.extend([os.path.join(base, filename)
  28. for filename in filenames])
  29. if filepaths:
  30. return {package: filepaths}
  31. else:
  32. return {}
  33. def read(fname):
  34. return open(os.path.join(os.path.dirname(__file__), fname)).read()
  35. setup(
  36. name='djangorestframework-bulk',
  37. version=__version__,
  38. author=__author__,
  39. author_email='miroslav@miki725.com',
  40. description='Django REST Framework bulk CRUD view mixins',
  41. long_description=read('README.rst') + read('LICENSE.rst'),
  42. url='https://github.com/miki725/django-rest-framework-bulk',
  43. license='MIT',
  44. keywords='django',
  45. packages=get_packages('rest_framework_bulk'),
  46. package_data=get_package_data('rest_framework_bulk'),
  47. install_requires=[
  48. 'django',
  49. 'djangorestframework',
  50. ],
  51. classifiers=[
  52. 'Development Status :: 3 - Alpha',
  53. 'Framework :: Django',
  54. 'Intended Audience :: Developers',
  55. 'Operating System :: OS Independent',
  56. 'Programming Language :: Python',
  57. 'Programming Language :: Python :: 3',
  58. 'Topic :: Utilities',
  59. 'Topic :: Internet :: WWW/HTTP',
  60. 'License :: OSI Approved :: MIT License',
  61. ],
  62. )