setup.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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(sys.modules["__main__"].__file__)))
  32. # Add Sentry to path so we can import distutils
  33. sys.path.insert(0, os.path.join(ROOT, "src"))
  34. from sentry.utils.distutils import (
  35. BuildAssetsCommand,
  36. BuildIntegrationDocsCommand,
  37. BuildJsSdkRegistryCommand,
  38. )
  39. # The version of sentry
  40. VERSION = "10.0.0.dev0"
  41. # Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error
  42. # in multiprocessing/util.py _exit_function when running `python
  43. # setup.py test` (see
  44. # http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
  45. for m in ("multiprocessing", "billiard"):
  46. try:
  47. __import__(m)
  48. except ImportError:
  49. pass
  50. IS_LIGHT_BUILD = os.environ.get("SENTRY_LIGHT_BUILD") == "1"
  51. # we use pip requirements files to improve Docker layer caching
  52. def get_requirements(env):
  53. with open(u"requirements-{}.txt".format(env)) as fp:
  54. return [x.strip() for x in fp.read().split("\n") if not x.startswith("#")]
  55. install_requires = get_requirements("base")
  56. dev_requires = get_requirements("dev")
  57. # override django version in requirements file if DJANGO_VERSION is set
  58. DJANGO_VERSION = os.environ.get("DJANGO_VERSION")
  59. if DJANGO_VERSION:
  60. install_requires = [
  61. u"Django{}".format(DJANGO_VERSION) if r.startswith("Django>=") else r
  62. for r in install_requires
  63. ]
  64. class SentrySDistCommand(SDistCommand):
  65. # If we are not a light build we want to also execute build_assets as
  66. # part of our source build pipeline.
  67. if not IS_LIGHT_BUILD:
  68. sub_commands = SDistCommand.sub_commands + [
  69. ("build_integration_docs", None),
  70. ("build_assets", None),
  71. ("build_js_sdk_registry", None),
  72. ]
  73. class SentryBuildCommand(BuildCommand):
  74. def run(self):
  75. if not IS_LIGHT_BUILD:
  76. self.run_command("build_integration_docs")
  77. self.run_command("build_assets")
  78. self.run_command("build_js_sdk_registry")
  79. BuildCommand.run(self)
  80. class SentryDevelopCommand(DevelopCommand):
  81. def run(self):
  82. DevelopCommand.run(self)
  83. if not IS_LIGHT_BUILD:
  84. self.run_command("build_integration_docs")
  85. self.run_command("build_assets")
  86. self.run_command("build_js_sdk_registry")
  87. cmdclass = {
  88. "sdist": SentrySDistCommand,
  89. "develop": SentryDevelopCommand,
  90. "build": SentryBuildCommand,
  91. "build_assets": BuildAssetsCommand,
  92. "build_integration_docs": BuildIntegrationDocsCommand,
  93. "build_js_sdk_registry": BuildJsSdkRegistryCommand,
  94. }
  95. setup(
  96. name="sentry",
  97. version=VERSION,
  98. author="Sentry",
  99. author_email="hello@sentry.io",
  100. url="https://sentry.io",
  101. description="A realtime logging and aggregation server.",
  102. long_description=open(os.path.join(ROOT, "README.rst")).read(),
  103. package_dir={"": "src"},
  104. packages=find_packages("src"),
  105. zip_safe=False,
  106. install_requires=install_requires,
  107. extras_require={"dev": dev_requires, "postgres": []},
  108. cmdclass=cmdclass,
  109. license="BSL-1.1",
  110. include_package_data=True,
  111. entry_points={
  112. "console_scripts": ["sentry = sentry.runner:main"],
  113. "sentry.apps": [
  114. "jira_ac = sentry_plugins.jira_ac",
  115. "jira = sentry_plugins.jira",
  116. "freight = sentry_plugins.freight",
  117. "sessionstack = sentry_plugins.sessionstack",
  118. ],
  119. "sentry.plugins": [
  120. "amazon_sqs = sentry_plugins.amazon_sqs.plugin:AmazonSQSPlugin",
  121. "asana = sentry_plugins.asana.plugin:AsanaPlugin",
  122. "bitbucket = sentry_plugins.bitbucket.plugin:BitbucketPlugin",
  123. "clubhouse = sentry_plugins.clubhouse.plugin:ClubhousePlugin",
  124. "freight = sentry_plugins.freight.plugin:FreightPlugin",
  125. "github = sentry_plugins.github.plugin:GitHubPlugin",
  126. "gitlab = sentry_plugins.gitlab.plugin:GitLabPlugin",
  127. "heroku = sentry_plugins.heroku.plugin:HerokuPlugin",
  128. "jira = sentry_plugins.jira.plugin:JiraPlugin",
  129. "jira_ac = sentry_plugins.jira_ac.plugin:JiraACPlugin",
  130. "phabricator = sentry_plugins.phabricator.plugin:PhabricatorPlugin",
  131. "pagerduty = sentry_plugins.pagerduty.plugin:PagerDutyPlugin",
  132. "pivotal = sentry_plugins.pivotal.plugin:PivotalPlugin",
  133. "pushover = sentry_plugins.pushover.plugin:PushoverPlugin",
  134. "segment = sentry_plugins.segment.plugin:SegmentPlugin",
  135. "sessionstack = sentry_plugins.sessionstack.plugin:SessionStackPlugin",
  136. "slack = sentry_plugins.slack.plugin:SlackPlugin",
  137. "splunk = sentry_plugins.splunk.plugin:SplunkPlugin",
  138. "victorops = sentry_plugins.victorops.plugin:VictorOpsPlugin",
  139. "vsts = sentry_plugins.vsts.plugin:VstsPlugin",
  140. ],
  141. },
  142. classifiers=[
  143. "Framework :: Django",
  144. "Intended Audience :: Developers",
  145. "Intended Audience :: System Administrators",
  146. "Operating System :: POSIX :: Linux",
  147. "Programming Language :: Python :: 2",
  148. "Programming Language :: Python :: 2.7",
  149. "Programming Language :: Python :: 2 :: Only",
  150. "Topic :: Software Development",
  151. "License :: Other/Proprietary License",
  152. ],
  153. )