]> jfr.im git - yt-dlp.git/blame - yt_dlp/__pyinstaller/hook-yt_dlp.py
[build] Include secretstorage in Linux builds
[yt-dlp.git] / yt_dlp / __pyinstaller / hook-yt_dlp.py
CommitLineData
acb1042a 1import sys
2
3from PyInstaller.utils.hooks import collect_submodules
4
5
b85faf6f 6def pycryptodome_module():
acb1042a 7 try:
8 import Cryptodome # noqa: F401
9 except ImportError:
10 try:
11 import Crypto # noqa: F401
12 print('WARNING: Using Crypto since Cryptodome is not available. '
13 'Install with: pip install pycryptodomex', file=sys.stderr)
14 return 'Crypto'
15 except ImportError:
16 pass
17 return 'Cryptodome'
18
19
b85faf6f 20def get_hidden_imports():
131d132d 21 yield from ('yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated')
22 yield from ('yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated')
65f6e807 23 yield pycryptodome_module()
8a8b5452 24 # Only `websockets` is required, others are collected just in case
25 for module in ('websockets', 'requests', 'urllib3'):
26 yield from collect_submodules(module)
acb1042a 27 # These are auto-detected, but explicitly add them just in case
9970d74c 28 yield from ('mutagen', 'brotli', 'certifi', 'secretstorage')
acb1042a 29
30
b85faf6f 31hiddenimports = list(get_hidden_imports())
32print(f'Adding imports: {hiddenimports}')
33
acb1042a 34excludedimports = ['youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts']