setup.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env python
  2. import os
  3. import sys
  4. from setuptools import setup
  5. from setuptools.command.build import build as BuildCommand
  6. from setuptools.command.develop import develop as DevelopCommand
  7. from setuptools.command.sdist import sdist as SDistCommand
  8. ROOT = os.path.dirname(os.path.abspath(__file__))
  9. # add sentry to path so we can import sentry.utils.distutils
  10. sys.path.insert(0, os.path.join(ROOT, "src"))
  11. from sentry.utils.distutils.commands.build_assets import BuildAssetsCommand
  12. from sentry.utils.distutils.commands.build_integration_docs import BuildIntegrationDocsCommand
  13. from sentry.utils.distutils.commands.build_js_sdk_registry import BuildJsSdkRegistryCommand
  14. class SentrySDistCommand(SDistCommand):
  15. sub_commands = [
  16. *SDistCommand.sub_commands,
  17. ("build_integration_docs", None),
  18. ("build_assets", None),
  19. ("build_js_sdk_registry", None),
  20. ]
  21. class SentryBuildCommand(BuildCommand):
  22. def run(self):
  23. import logging
  24. logging.getLogger("sentry").setLevel(logging.WARNING)
  25. self.run_command("build_integration_docs")
  26. self.run_command("build_assets")
  27. self.run_command("build_js_sdk_registry")
  28. super().run()
  29. class SentryDevelopCommand(DevelopCommand):
  30. def run(self):
  31. super().run()
  32. self.run_command("build_integration_docs")
  33. self.run_command("build_assets")
  34. self.run_command("build_js_sdk_registry")
  35. cmdclass = {
  36. "sdist": SentrySDistCommand,
  37. "develop": SentryDevelopCommand,
  38. "build": SentryBuildCommand,
  39. "build_assets": BuildAssetsCommand,
  40. "build_integration_docs": BuildIntegrationDocsCommand,
  41. "build_js_sdk_registry": BuildJsSdkRegistryCommand,
  42. }
  43. setup(cmdclass=cmdclass)