setup.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/usr/bin/env python
  2. """
  3. Sentry
  4. ======
  5. Sentry is a realtime event logging and aggregation platform. It specializes
  6. in monitoring errors and extracting all the information needed to do a proper
  7. post-mortem without any of the hassle of the standard user feedback loop.
  8. Sentry is a Server
  9. ------------------
  10. The Sentry package, at its core, is just a simple server and web UI. It will
  11. handle authentication clients (such as `Raven
  12. <https://github.com/getsentry/raven-python>`_)
  13. and all of the logic behind storage and aggregation.
  14. That said, Sentry is not limited to Python. The primary implementation is in
  15. Python, but it contains a full API for sending events from any language, in
  16. any application.
  17. :copyright: (c) 2011-2014 by the Sentry Team, see AUTHORS for more details.
  18. :license: BSD, see LICENSE for more details.
  19. """
  20. from __future__ import absolute_import
  21. # if sys.version_info[:2] != (2, 7):
  22. # print 'Error: Sentry requires Python 2.7'
  23. # sys.exit(1)
  24. import os
  25. import os.path
  26. import sys
  27. from distutils.command.build import build as BuildCommand
  28. from setuptools import setup, find_packages
  29. from setuptools.command.sdist import sdist as SDistCommand
  30. from setuptools.command.develop import develop as DevelopCommand
  31. ROOT = os.path.realpath(os.path.join(os.path.dirname(
  32. sys.modules['__main__'].__file__)))
  33. # Add Sentry to path so we can import distutils
  34. sys.path.insert(0, os.path.join(ROOT, 'src'))
  35. from sentry.utils.distutils import (
  36. BuildAssetsCommand, BuildIntegrationDocsCommand
  37. )
  38. # The version of sentry
  39. VERSION = '8.23.0.dev0'
  40. # Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error
  41. # in multiprocessing/util.py _exit_function when running `python
  42. # setup.py test` (see
  43. # http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
  44. for m in ('multiprocessing', 'billiard'):
  45. try:
  46. __import__(m)
  47. except ImportError:
  48. pass
  49. IS_LIGHT_BUILD = os.environ.get('SENTRY_LIGHT_BUILD') == '1'
  50. # we use pip requirements files to improve Docker layer caching
  51. def get_requirements(env):
  52. with open('requirements-{}.txt'.format(env)) as fp:
  53. return [x.strip() for x in fp.read().split('\n') if not x.startswith('#')]
  54. install_requires = get_requirements('base')
  55. dev_requires = get_requirements('dev')
  56. tests_require = get_requirements('test')
  57. optional_requires = get_requirements('optional')
  58. class SentrySDistCommand(SDistCommand):
  59. # If we are not a light build we want to also execute build_assets as
  60. # part of our source build pipeline.
  61. if not IS_LIGHT_BUILD:
  62. sub_commands = SDistCommand.sub_commands + \
  63. [('build_integration_docs', None), ('build_assets', None)]
  64. class SentryBuildCommand(BuildCommand):
  65. def run(self):
  66. BuildCommand.run(self)
  67. if not IS_LIGHT_BUILD:
  68. self.run_command('build_integration_docs')
  69. self.run_command('build_assets')
  70. class SentryDevelopCommand(DevelopCommand):
  71. def run(self):
  72. DevelopCommand.run(self)
  73. if not IS_LIGHT_BUILD:
  74. self.run_command('build_integration_docs')
  75. self.run_command('build_assets')
  76. cmdclass = {
  77. 'sdist': SentrySDistCommand,
  78. 'develop': SentryDevelopCommand,
  79. 'build': SentryBuildCommand,
  80. 'build_assets': BuildAssetsCommand,
  81. 'build_integration_docs': BuildIntegrationDocsCommand,
  82. }
  83. setup(
  84. name='sentry',
  85. version=VERSION,
  86. author='Sentry',
  87. author_email='hello@sentry.io',
  88. url='https://sentry.io',
  89. description='A realtime logging and aggregation server.',
  90. long_description=open(os.path.join(ROOT, 'README.rst')).read(),
  91. package_dir={'': 'src'},
  92. packages=find_packages('src'),
  93. zip_safe=False,
  94. install_requires=install_requires,
  95. extras_require={
  96. 'dev': dev_requires,
  97. 'postgres': [],
  98. 'tests': tests_require,
  99. 'optional': optional_requires,
  100. },
  101. cmdclass=cmdclass,
  102. license='BSD',
  103. include_package_data=True,
  104. entry_points={
  105. 'console_scripts': [
  106. 'sentry = sentry.runner:main',
  107. ],
  108. 'flake8.extension': [
  109. ],
  110. },
  111. classifiers=[
  112. 'Framework :: Django',
  113. 'Intended Audience :: Developers',
  114. 'Intended Audience :: System Administrators',
  115. 'Operating System :: POSIX :: Linux',
  116. 'Programming Language :: Python :: 2',
  117. 'Programming Language :: Python :: 2.7',
  118. 'Programming Language :: Python :: 2 :: Only',
  119. 'Topic :: Software Development'
  120. ],
  121. )