setup.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # -*- coding: utf-8 -
  2. #
  3. # This file is part of gunicorn released under the MIT license.
  4. # See the NOTICE for more information.
  5. import os
  6. import sys
  7. from setuptools import setup, find_packages
  8. from setuptools.command.test import test as TestCommand
  9. from gunicorn import __version__
  10. CLASSIFIERS = [
  11. 'Development Status :: 4 - Beta',
  12. 'Environment :: Other Environment',
  13. 'Intended Audience :: Developers',
  14. 'License :: OSI Approved :: MIT License',
  15. 'Operating System :: MacOS :: MacOS X',
  16. 'Operating System :: POSIX',
  17. 'Programming Language :: Python',
  18. 'Programming Language :: Python :: 2',
  19. 'Programming Language :: Python :: 2.6',
  20. 'Programming Language :: Python :: 2.7',
  21. 'Programming Language :: Python :: 3',
  22. 'Programming Language :: Python :: 3.2',
  23. 'Programming Language :: Python :: 3.3',
  24. 'Programming Language :: Python :: 3.4',
  25. 'Programming Language :: Python :: 3.5',
  26. 'Programming Language :: Python :: 3.6',
  27. 'Topic :: Internet',
  28. 'Topic :: Utilities',
  29. 'Topic :: Software Development :: Libraries :: Python Modules',
  30. 'Topic :: Internet :: WWW/HTTP',
  31. 'Topic :: Internet :: WWW/HTTP :: WSGI',
  32. 'Topic :: Internet :: WWW/HTTP :: WSGI :: Server',
  33. 'Topic :: Internet :: WWW/HTTP :: Dynamic Content']
  34. # read long description
  35. with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
  36. long_description = f.read()
  37. # read dev requirements
  38. fname = os.path.join(os.path.dirname(__file__), 'requirements_test.txt')
  39. with open(fname) as f:
  40. tests_require = [l.strip() for l in f.readlines()]
  41. if sys.version_info[:2] < (3, 3):
  42. tests_require.append('mock')
  43. if sys.version_info[:2] < (2, 7):
  44. tests_require.append('unittest2')
  45. class PyTestCommand(TestCommand):
  46. user_options = [
  47. ("cov", None, "measure coverage")
  48. ]
  49. def initialize_options(self):
  50. TestCommand.initialize_options(self)
  51. self.cov = None
  52. def finalize_options(self):
  53. TestCommand.finalize_options(self)
  54. self.test_args = ['tests']
  55. if self.cov:
  56. self.test_args += ['--cov', 'gunicorn']
  57. self.test_suite = True
  58. def run_tests(self):
  59. import pytest
  60. errno = pytest.main(self.test_args)
  61. sys.exit(errno)
  62. extra_require = {
  63. 'gevent': ['gevent>=0.13'],
  64. 'eventlet': ['eventlet>=0.9.7'],
  65. 'tornado': ['tornado>=0.2'],
  66. 'gthread': [],
  67. }
  68. if sys.version_info[0] < 3:
  69. extra_require['gthread'] = ['futures']
  70. setup(
  71. name='gunicorn',
  72. version=__version__,
  73. description='WSGI HTTP Server for UNIX',
  74. long_description=long_description,
  75. author='Benoit Chesneau',
  76. author_email='benoitc@e-engura.com',
  77. license='MIT',
  78. url='http://gunicorn.org',
  79. python_requires='>=2.6, !=3.0.*, !=3.1.*',
  80. classifiers=CLASSIFIERS,
  81. zip_safe=False,
  82. packages=find_packages(exclude=['examples', 'tests']),
  83. include_package_data=True,
  84. tests_require=tests_require,
  85. cmdclass={'test': PyTestCommand},
  86. entry_points="""
  87. [console_scripts]
  88. gunicorn=gunicorn.app.wsgiapp:run
  89. gunicorn_paster=gunicorn.app.pasterapp:run
  90. [paste.server_runner]
  91. main=gunicorn.app.pasterapp:paste_server
  92. """,
  93. extras_require=extra_require,
  94. )