hook-sentry_sdk.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2020 PyInstaller Development Team.
  3. #
  4. # This file is distributed under the terms of the GNU General Public
  5. # License (version 2.0 or later).
  6. #
  7. # The full license is available in LICENSE, distributed with
  8. # this software.
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. # ------------------------------------------------------------------
  12. from PyInstaller import isolated
  13. hiddenimports = [
  14. "sentry_sdk.integrations.stdlib",
  15. "sentry_sdk.integrations.excepthook",
  16. "sentry_sdk.integrations.dedupe",
  17. "sentry_sdk.integrations.atexit",
  18. "sentry_sdk.integrations.modules",
  19. "sentry_sdk.integrations.argv",
  20. "sentry_sdk.integrations.logging",
  21. "sentry_sdk.integrations.threading",
  22. ]
  23. @isolated.decorate
  24. def _get_integration_modules():
  25. import sentry_sdk.integrations as si
  26. # _AUTO_ENABLING_INTEGRATIONS is a list of strings with default enabled integrations
  27. # https://github.com/getsentry/sentry-python/blob/c6b6f2086b58ffc674df5c25a600b8a615079fb5/sentry_sdk/integrations/__init__.py#L54-L66
  28. integrations = getattr(si, '_AUTO_ENABLING_INTEGRATIONS', [])
  29. # The list contains fully-qualified class names; turn them into module names by removing the last component.
  30. return [integration_name.rsplit('.', maxsplit=1)[0] for integration_name in integrations]
  31. hiddenimports += _get_integration_modules()