mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 19:33:59 +01:00
47ab66db0f
Closes #8355, #8944 Authored by: bashonly, Grub4k, Arthurszzz, seproDev, pukkandan Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com> Co-authored-by: bashonly <bashonly@protonmail.com> Co-authored-by: Arthurszzz <minecraftgamerarthur@gmail.com> Co-authored-by: Simon Sawicki <accounts@grub4k.xyz> Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
import sys
|
|
|
|
from PyInstaller.utils.hooks import collect_submodules
|
|
|
|
|
|
def pycryptodome_module():
|
|
try:
|
|
import Cryptodome # noqa: F401
|
|
except ImportError:
|
|
try:
|
|
import Crypto # noqa: F401
|
|
print('WARNING: Using Crypto since Cryptodome is not available. '
|
|
'Install with: python3 -m pip install pycryptodomex', file=sys.stderr)
|
|
return 'Crypto'
|
|
except ImportError:
|
|
pass
|
|
return 'Cryptodome'
|
|
|
|
|
|
def get_hidden_imports():
|
|
yield from ('yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated')
|
|
yield from ('yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated')
|
|
yield pycryptodome_module()
|
|
# Only `websockets` is required, others are collected just in case
|
|
for module in ('websockets', 'requests', 'urllib3'):
|
|
yield from collect_submodules(module)
|
|
# These are auto-detected, but explicitly add them just in case
|
|
yield from ('mutagen', 'brotli', 'certifi', 'secretstorage')
|
|
|
|
|
|
hiddenimports = list(get_hidden_imports())
|
|
print(f'Adding imports: {hiddenimports}')
|
|
|
|
excludedimports = ['youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts', 'bundle']
|