setup.py 7.1 KB

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