setup.py 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.rst")).read(),
  74. package_dir={"": "src"},
  75. packages=find_packages("src"),
  76. zip_safe=False,
  77. install_requires=install_requires,
  78. extras_require={"dev": dev_requires},
  79. cmdclass=cmdclass,
  80. license="BSL-1.1",
  81. include_package_data=True,
  82. entry_points={
  83. "console_scripts": ["sentry = sentry.runner:main"],
  84. "sentry.apps": [
  85. "jira_ac = sentry_plugins.jira_ac",
  86. "jira = sentry_plugins.jira",
  87. "freight = sentry_plugins.freight",
  88. "opsgenie = sentry_plugins.opsgenie",
  89. "redmine = sentry_plugins.redmine",
  90. "sessionstack = sentry_plugins.sessionstack",
  91. "teamwork = sentry_plugins.teamwork",
  92. "twilio = sentry_plugins.twilio",
  93. ],
  94. "sentry.plugins": [
  95. "amazon_sqs = sentry_plugins.amazon_sqs.plugin:AmazonSQSPlugin",
  96. "asana = sentry_plugins.asana.plugin:AsanaPlugin",
  97. "bitbucket = sentry_plugins.bitbucket.plugin:BitbucketPlugin",
  98. "clubhouse = sentry_plugins.clubhouse.plugin:ClubhousePlugin",
  99. "freight = sentry_plugins.freight.plugin:FreightPlugin",
  100. "github = sentry_plugins.github.plugin:GitHubPlugin",
  101. "gitlab = sentry_plugins.gitlab.plugin:GitLabPlugin",
  102. "heroku = sentry_plugins.heroku.plugin:HerokuPlugin",
  103. "jira = sentry_plugins.jira.plugin:JiraPlugin",
  104. "jira_ac = sentry_plugins.jira_ac.plugin:JiraACPlugin",
  105. "opsgenie = sentry_plugins.opsgenie.plugin:OpsGeniePlugin",
  106. "pagerduty = sentry_plugins.pagerduty.plugin:PagerDutyPlugin",
  107. "phabricator = sentry_plugins.phabricator.plugin:PhabricatorPlugin",
  108. "pivotal = sentry_plugins.pivotal.plugin:PivotalPlugin",
  109. "pushover = sentry_plugins.pushover.plugin:PushoverPlugin",
  110. "redmine = sentry_plugins.redmine.plugin:RedminePlugin",
  111. "segment = sentry_plugins.segment.plugin:SegmentPlugin",
  112. "sessionstack = sentry_plugins.sessionstack.plugin:SessionStackPlugin",
  113. "slack = sentry_plugins.slack.plugin:SlackPlugin",
  114. "splunk = sentry_plugins.splunk.plugin:SplunkPlugin",
  115. "teamwork = sentry_plugins.teamwork.plugin:TeamworkPlugin",
  116. "twilio = sentry_plugins.twilio.plugin:TwilioPlugin",
  117. "victorops = sentry_plugins.victorops.plugin:VictorOpsPlugin",
  118. "vsts = sentry_plugins.vsts.plugin:VstsPlugin",
  119. ],
  120. },
  121. classifiers=[
  122. "Framework :: Django",
  123. "Intended Audience :: Developers",
  124. "Intended Audience :: System Administrators",
  125. "Operating System :: POSIX :: Linux",
  126. "Programming Language :: Python :: 2",
  127. "Programming Language :: Python :: 2.7",
  128. "Programming Language :: Python :: 2 :: Only",
  129. "Topic :: Software Development",
  130. "License :: Other/Proprietary License",
  131. ],
  132. )