2023-02-08 19:42:08 +00:00
|
|
|
import sys
|
|
|
|
|
2024-03-17 03:52:38 +00:00
|
|
|
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
|
2023-02-08 19:42:08 +00:00
|
|
|
|
|
|
|
|
2023-02-09 06:26:12 +00:00
|
|
|
def pycryptodome_module():
|
2023-02-08 19:42:08 +00:00
|
|
|
try:
|
|
|
|
import Cryptodome # noqa: F401
|
|
|
|
except ImportError:
|
|
|
|
try:
|
|
|
|
import Crypto # noqa: F401
|
|
|
|
print('WARNING: Using Crypto since Cryptodome is not available. '
|
2024-03-10 19:18:47 +00:00
|
|
|
'Install with: python3 -m pip install pycryptodomex', file=sys.stderr)
|
2023-02-08 19:42:08 +00:00
|
|
|
return 'Crypto'
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
return 'Cryptodome'
|
|
|
|
|
|
|
|
|
2023-02-09 06:26:12 +00:00
|
|
|
def get_hidden_imports():
|
2023-07-15 11:09:45 +00:00
|
|
|
yield from ('yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated')
|
|
|
|
yield from ('yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated')
|
2023-02-28 17:40:54 +00:00
|
|
|
yield pycryptodome_module()
|
2023-10-13 23:33:00 +00: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 19:42:08 +00:00
|
|
|
# These are auto-detected, but explicitly add them just in case
|
2024-03-17 03:52:38 +00:00
|
|
|
yield from ('mutagen', 'brotli', 'certifi', 'secretstorage', 'curl_cffi')
|
2023-02-08 19:42:08 +00:00
|
|
|
|
|
|
|
|
2023-02-09 06:26:12 +00:00
|
|
|
hiddenimports = list(get_hidden_imports())
|
|
|
|
print(f'Adding imports: {hiddenimports}')
|
|
|
|
|
2024-02-18 20:33:23 +00:00
|
|
|
excludedimports = ['youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts', 'bundle']
|
2024-03-17 03:52:38 +00:00
|
|
|
|
|
|
|
datas = collect_data_files('curl_cffi', includes=['cacert.pem'])
|