zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ------------------------------------------------------------------
import json
from PyInstaller.utils.hooks import exec_statement
 
hiddenimports = ["sentry_sdk.integrations.stdlib",
                 "sentry_sdk.integrations.excepthook",
                 "sentry_sdk.integrations.dedupe",
                 "sentry_sdk.integrations.atexit",
                 "sentry_sdk.integrations.modules",
                 "sentry_sdk.integrations.argv",
                 "sentry_sdk.integrations.logging",
                 "sentry_sdk.integrations.threading"]
 
statement = """
import json
import sentry_sdk.integrations as si
 
integrations = []
if hasattr(si, '_AUTO_ENABLING_INTEGRATIONS'):
    # _AUTO_ENABLING_INTEGRATIONS is a list of strings with default enabled integrations
    # https://github.com/getsentry/sentry-python/blob/c6b6f2086b58ffc674df5c25a600b8a615079fb5/sentry_sdk/integrations/__init__.py#L54-L66
 
    def make_integration_name(integration_name: str):
        return integration_name.rsplit(".", maxsplit=1)[0]
 
    integrations.extend(map(make_integration_name, si._AUTO_ENABLING_INTEGRATIONS))
print(json.dumps(integrations))
"""
 
hiddenimports.extend(json.loads(exec_statement(statement)))