setup.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 `the Python one
  12. <https://github.com/getsentry/sentry-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, BuildJsSdkRegistryCommand
  37. )
  38. # The version of sentry
  39. VERSION = '9.1.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(u'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. # override django version in requirements file if DJANGO_VERSION is set
  59. DJANGO_VERSION = os.environ.get('DJANGO_VERSION')
  60. if DJANGO_VERSION:
  61. install_requires = [
  62. u'Django{}'.format(DJANGO_VERSION)
  63. if r.startswith('Django>=') else r
  64. for r in install_requires
  65. ]
  66. class SentrySDistCommand(SDistCommand):
  67. # If we are not a light build we want to also execute build_assets as
  68. # part of our source build pipeline.
  69. if not IS_LIGHT_BUILD:
  70. sub_commands = SDistCommand.sub_commands + \
  71. [('build_integration_docs', None),
  72. ('build_assets', None),
  73. ('build_js_sdk_registry', None)]
  74. class SentryBuildCommand(BuildCommand):
  75. def run(self):
  76. BuildCommand.run(self)
  77. if not IS_LIGHT_BUILD:
  78. self.run_command('build_integration_docs')
  79. self.run_command('build_assets')
  80. self.run_command('build_js_sdk_registry')
  81. class SentryDevelopCommand(DevelopCommand):
  82. def run(self):
  83. DevelopCommand.run(self)
  84. if not IS_LIGHT_BUILD:
  85. self.run_command('build_integration_docs')
  86. self.run_command('build_assets')
  87. self.run_command('build_js_sdk_registry')
  88. cmdclass = {
  89. 'sdist': SentrySDistCommand,
  90. 'develop': SentryDevelopCommand,
  91. 'build': SentryBuildCommand,
  92. 'build_assets': BuildAssetsCommand,
  93. 'build_integration_docs': BuildIntegrationDocsCommand,
  94. 'build_js_sdk_registry': BuildJsSdkRegistryCommand,
  95. }
  96. setup(
  97. name='sentry',
  98. version=VERSION,
  99. author='Sentry',
  100. author_email='hello@sentry.io',
  101. url='https://sentry.io',
  102. description='A realtime logging and aggregation server.',
  103. long_description=open(os.path.join(ROOT, 'README.rst')).read(),
  104. package_dir={'': 'src'},
  105. packages=find_packages('src'),
  106. zip_safe=False,
  107. install_requires=install_requires,
  108. extras_require={
  109. 'dev': dev_requires,
  110. 'postgres': [],
  111. 'tests': tests_require,
  112. 'optional': optional_requires,
  113. },
  114. cmdclass=cmdclass,
  115. license='BSD',
  116. include_package_data=True,
  117. entry_points={
  118. 'console_scripts': [
  119. 'sentry = sentry.runner:main',
  120. ],
  121. },
  122. classifiers=[
  123. 'Framework :: Django',
  124. 'Intended Audience :: Developers',
  125. 'Intended Audience :: System Administrators',
  126. 'Operating System :: POSIX :: Linux',
  127. 'Programming Language :: Python :: 2',
  128. 'Programming Language :: Python :: 2.7',
  129. 'Programming Language :: Python :: 2 :: Only',
  130. 'Topic :: Software Development'
  131. ],
  132. )