setup.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env python
  2. from __future__ import absolute_import
  3. import sys
  4. if sys.version_info[:2] != (2, 7):
  5. sys.exit("Error: Sentry requires Python 2.7.")
  6. import os
  7. import os.path
  8. from distutils.command.build import build as BuildCommand
  9. from setuptools import setup, find_packages
  10. from setuptools.command.sdist import sdist as SDistCommand
  11. from setuptools.command.develop import develop as DevelopCommand
  12. ROOT = os.path.dirname(os.path.abspath(__file__))
  13. # add sentry to path so we can import distutils
  14. # XXX: consequentially, this means sentry must be pip installed with --no-use-pep517
  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 = "10.0.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. 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_github = sentry.auth.providers.github",
  88. "jira_ac = sentry_plugins.jira_ac",
  89. "jira = sentry_plugins.jira",
  90. "freight = sentry_plugins.freight",
  91. "opsgenie = sentry_plugins.opsgenie",
  92. "redmine = sentry_plugins.redmine",
  93. "sessionstack = sentry_plugins.sessionstack",
  94. "teamwork = sentry_plugins.teamwork",
  95. "trello = sentry_plugins.trello",
  96. "twilio = sentry_plugins.twilio",
  97. ],
  98. "sentry.plugins": [
  99. "amazon_sqs = sentry_plugins.amazon_sqs.plugin:AmazonSQSPlugin",
  100. "asana = sentry_plugins.asana.plugin:AsanaPlugin",
  101. "bitbucket = sentry_plugins.bitbucket.plugin:BitbucketPlugin",
  102. "clubhouse = sentry_plugins.clubhouse.plugin:ClubhousePlugin",
  103. "freight = sentry_plugins.freight.plugin:FreightPlugin",
  104. "github = sentry_plugins.github.plugin:GitHubPlugin",
  105. "gitlab = sentry_plugins.gitlab.plugin:GitLabPlugin",
  106. "heroku = sentry_plugins.heroku.plugin:HerokuPlugin",
  107. "jira = sentry_plugins.jira.plugin:JiraPlugin",
  108. "jira_ac = sentry_plugins.jira_ac.plugin:JiraACPlugin",
  109. "opsgenie = sentry_plugins.opsgenie.plugin:OpsGeniePlugin",
  110. "pagerduty = sentry_plugins.pagerduty.plugin:PagerDutyPlugin",
  111. "phabricator = sentry_plugins.phabricator.plugin:PhabricatorPlugin",
  112. "pivotal = sentry_plugins.pivotal.plugin:PivotalPlugin",
  113. "pushover = sentry_plugins.pushover.plugin:PushoverPlugin",
  114. "redmine = sentry_plugins.redmine.plugin:RedminePlugin",
  115. "segment = sentry_plugins.segment.plugin:SegmentPlugin",
  116. "sessionstack = sentry_plugins.sessionstack.plugin:SessionStackPlugin",
  117. "slack = sentry_plugins.slack.plugin:SlackPlugin",
  118. "splunk = sentry_plugins.splunk.plugin:SplunkPlugin",
  119. "teamwork = sentry_plugins.teamwork.plugin:TeamworkPlugin",
  120. "trello = sentry_plugins.trello.plugin:TrelloPlugin",
  121. "twilio = sentry_plugins.twilio.plugin:TwilioPlugin",
  122. "victorops = sentry_plugins.victorops.plugin:VictorOpsPlugin",
  123. "vsts = sentry_plugins.vsts.plugin:VstsPlugin",
  124. ],
  125. },
  126. classifiers=[
  127. "Framework :: Django",
  128. "Intended Audience :: Developers",
  129. "Intended Audience :: System Administrators",
  130. "Operating System :: POSIX :: Linux",
  131. "Programming Language :: Python :: 2",
  132. "Programming Language :: Python :: 2.7",
  133. "Programming Language :: Python :: 2 :: Only",
  134. "Topic :: Software Development",
  135. "License :: Other/Proprietary License",
  136. ],
  137. )