setup.py 6.4 KB

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