2023-02-08 12:42:08 -07:00
|
|
|
import sys
|
|
|
|
|
|
|
|
from PyInstaller.utils.hooks import collect_submodules
|
|
|
|
|
|
|
|
|
2023-02-08 23:26:12 -07:00
|
|
|
def pycryptodome_module():
|
2023-02-08 12:42:08 -07:00
|
|
|
try:
|
|
|
|
import Cryptodome # noqa: F401
|
|
|
|
except ImportError:
|
|
|
|
try:
|
|
|
|
import Crypto # noqa: F401
|
|
|
|
print('WARNING: Using Crypto since Cryptodome is not available. '
|
|
|
|
'Install with: pip install pycryptodomex', file=sys.stderr)
|
|
|
|
return 'Crypto'
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
return 'Cryptodome'
|
|
|
|
|
|
|
|
|
2023-02-08 23:26:12 -07:00
|
|
|
def get_hidden_imports():
|
2023-07-15 05:09:45 -06:00
|
|
|
yield from ('yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated')
|
|
|
|
yield from ('yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated')
|
2023-02-28 10:40:54 -07:00
|
|
|
yield pycryptodome_module()
|
2023-10-13 17:33:00 -06:00
|
|
|
# Only `websockets` is required, others are collected just in case
|
|
|
|
for module in ('websockets', 'requests', 'urllib3'):
|
|
|
|
yield from collect_submodules(module)
|
2023-02-08 12:42:08 -07:00
|
|
|
# These are auto-detected, but explicitly add them just in case
|
2023-11-12 14:58:13 -07:00
|
|
|
yield from ('mutagen', 'brotli', 'certifi', 'secretstorage')
|
2023-02-08 12:42:08 -07:00
|
|
|
|
|
|
|
|
2023-02-08 23:26:12 -07:00
|
|
|
hiddenimports = list(get_hidden_imports())
|
|
|
|
print(f'Adding imports: {hiddenimports}')
|
|
|
|
|
2023-02-08 12:42:08 -07:00
|
|
|
excludedimports = ['youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts']
|