setup.py 6.4 KB

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