setup.py 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #!/usr/bin/env python
  2. from __future__ import absolute_import
  3. import os
  4. import sys
  5. if os.environ.get("SENTRY_PYTHON3") and sys.version_info[:2] != (3, 6):
  6. sys.exit("Error: Sentry [In EXPERIMENTAL python 3 mode] requires Python 3.6.")
  7. if not os.environ.get("SENTRY_PYTHON3") and sys.version_info[:2] != (2, 7):
  8. sys.exit("Error: Sentry requires Python 2.7.")
  9. from distutils.command.build import build as BuildCommand
  10. from setuptools import setup, find_packages
  11. from setuptools.command.sdist import sdist as SDistCommand
  12. from setuptools.command.develop import develop as DevelopCommand
  13. ROOT = os.path.dirname(os.path.abspath(__file__))
  14. # add sentry to path so we can import sentry.utils.distutils
  15. sys.path.insert(0, os.path.join(ROOT, "src"))
  16. from sentry.utils.distutils import (
  17. BuildAssetsCommand,
  18. BuildIntegrationDocsCommand,
  19. BuildJsSdkRegistryCommand,
  20. )
  21. VERSION = "20.8.0.dev0"
  22. IS_LIGHT_BUILD = os.environ.get("SENTRY_LIGHT_BUILD") == "1"
  23. def get_requirements(env):
  24. with open(u"requirements-{}.txt".format(env)) as fp:
  25. return [x.strip() for x in fp.read().split("\n") if not x.startswith("#")]
  26. install_requires = get_requirements("base")
  27. dev_requires = get_requirements("dev")
  28. # override django version in requirements file if DJANGO_VERSION is set
  29. DJANGO_VERSION = os.environ.get("DJANGO_VERSION")
  30. if DJANGO_VERSION:
  31. install_requires = [
  32. u"Django{}".format(DJANGO_VERSION) if r.startswith("Django>=") else r
  33. for r in install_requires
  34. ]
  35. class SentrySDistCommand(SDistCommand):
  36. # If we are not a light build we want to also execute build_assets as
  37. # part of our source build pipeline.
  38. if not IS_LIGHT_BUILD:
  39. sub_commands = SDistCommand.sub_commands + [
  40. ("build_integration_docs", None),
  41. ("build_assets", None),
  42. ("build_js_sdk_registry", None),
  43. ]
  44. class SentryBuildCommand(BuildCommand):
  45. def run(self):
  46. from distutils import log as distutils_log
  47. distutils_log.set_threshold(distutils_log.WARN)
  48. if not IS_LIGHT_BUILD:
  49. self.run_command("build_integration_docs")
  50. self.run_command("build_assets")
  51. self.run_command("build_js_sdk_registry")
  52. BuildCommand.run(self)
  53. class SentryDevelopCommand(DevelopCommand):
  54. def run(self):
  55. DevelopCommand.run(self)
  56. if not IS_LIGHT_BUILD:
  57. self.run_command("build_integration_docs")
  58. self.run_command("build_assets")
  59. self.run_command("build_js_sdk_registry")
  60. cmdclass = {
  61. "sdist": SentrySDistCommand,
  62. "develop": SentryDevelopCommand,
  63. "build": SentryBuildCommand,
  64. "build_assets": BuildAssetsCommand,
  65. "build_integration_docs": BuildIntegrationDocsCommand,
  66. "build_js_sdk_registry": BuildJsSdkRegistryCommand,
  67. }
  68. setup(
  69. name="sentry",
  70. version=VERSION,
  71. author="Sentry",
  72. author_email="hello@sentry.io",
  73. url="https://sentry.io",
  74. description="A realtime logging and aggregation server.",
  75. long_description=open(os.path.join(ROOT, "README.md")).read(),
  76. long_description_content_type="text/markdown",
  77. package_dir={"": "src"},
  78. packages=find_packages("src"),
  79. zip_safe=False,
  80. install_requires=install_requires,
  81. extras_require={"dev": dev_requires},
  82. cmdclass=cmdclass,
  83. license="BSL-1.1",
  84. include_package_data=True,
  85. entry_points={
  86. "console_scripts": ["sentry = sentry.runner:main"],
  87. "sentry.apps": [
  88. # TODO: This can be removed once the getsentry tests no longer check for this app
  89. "auth_activedirectory = sentry.auth.providers.saml2.activedirectory",
  90. "auth_auth0 = sentry.auth.providers.saml2.auth0",
  91. "auth_github = sentry.auth.providers.github",
  92. "auth_okta = sentry.auth.providers.saml2.okta",
  93. "auth_onelogin = sentry.auth.providers.saml2.onelogin",
  94. "auth_rippling = sentry.auth.providers.saml2.rippling",
  95. "auth_saml2 = sentry.auth.providers.saml2.generic",
  96. "jira_ac = sentry_plugins.jira_ac",
  97. "jira = sentry_plugins.jira",
  98. "freight = sentry_plugins.freight",
  99. "opsgenie = sentry_plugins.opsgenie",
  100. "redmine = sentry_plugins.redmine",
  101. "sessionstack = sentry_plugins.sessionstack",
  102. "teamwork = sentry_plugins.teamwork",
  103. "trello = sentry_plugins.trello",
  104. "twilio = sentry_plugins.twilio",
  105. ],
  106. "sentry.plugins": [
  107. "amazon_sqs = sentry_plugins.amazon_sqs.plugin:AmazonSQSPlugin",
  108. "asana = sentry_plugins.asana.plugin:AsanaPlugin",
  109. "bitbucket = sentry_plugins.bitbucket.plugin:BitbucketPlugin",
  110. "clubhouse = sentry_plugins.clubhouse.plugin:ClubhousePlugin",
  111. "freight = sentry_plugins.freight.plugin:FreightPlugin",
  112. "github = sentry_plugins.github.plugin:GitHubPlugin",
  113. "gitlab = sentry_plugins.gitlab.plugin:GitLabPlugin",
  114. "heroku = sentry_plugins.heroku.plugin:HerokuPlugin",
  115. "jira = sentry_plugins.jira.plugin:JiraPlugin",
  116. "jira_ac = sentry_plugins.jira_ac.plugin:JiraACPlugin",
  117. "opsgenie = sentry_plugins.opsgenie.plugin:OpsGeniePlugin",
  118. "pagerduty = sentry_plugins.pagerduty.plugin:PagerDutyPlugin",
  119. "phabricator = sentry_plugins.phabricator.plugin:PhabricatorPlugin",
  120. "pivotal = sentry_plugins.pivotal.plugin:PivotalPlugin",
  121. "pushover = sentry_plugins.pushover.plugin:PushoverPlugin",
  122. "redmine = sentry_plugins.redmine.plugin:RedminePlugin",
  123. "segment = sentry_plugins.segment.plugin:SegmentPlugin",
  124. "sessionstack = sentry_plugins.sessionstack.plugin:SessionStackPlugin",
  125. "slack = sentry_plugins.slack.plugin:SlackPlugin",
  126. "splunk = sentry_plugins.splunk.plugin:SplunkPlugin",
  127. "teamwork = sentry_plugins.teamwork.plugin:TeamworkPlugin",
  128. "trello = sentry_plugins.trello.plugin:TrelloPlugin",
  129. "twilio = sentry_plugins.twilio.plugin:TwilioPlugin",
  130. "victorops = sentry_plugins.victorops.plugin:VictorOpsPlugin",
  131. "vsts = sentry_plugins.vsts.plugin:VstsPlugin",
  132. ],
  133. },
  134. classifiers=[
  135. "Framework :: Django",
  136. "Intended Audience :: Developers",
  137. "Intended Audience :: System Administrators",
  138. "Operating System :: POSIX :: Linux",
  139. "Programming Language :: Python :: 2",
  140. "Programming Language :: Python :: 2.7",
  141. "Programming Language :: Python :: 2 :: Only",
  142. "Topic :: Software Development",
  143. "License :: Other/Proprietary License",
  144. ],
  145. )