aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/__pyinstaller/hook-yt_dlp.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/__pyinstaller/hook-yt_dlp.py')
-rw-r--r--hypervideo_dl/__pyinstaller/hook-yt_dlp.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/hypervideo_dl/__pyinstaller/hook-yt_dlp.py b/hypervideo_dl/__pyinstaller/hook-yt_dlp.py
new file mode 100644
index 0000000..67e1291
--- /dev/null
+++ b/hypervideo_dl/__pyinstaller/hook-yt_dlp.py
@@ -0,0 +1,32 @@
+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: pip install pycryptodomex', file=sys.stderr)
+ return 'Crypto'
+ except ImportError:
+ pass
+ return 'Cryptodome'
+
+
+def get_hidden_imports():
+ yield from ('hypervideo_dl.compat._legacy', 'hypervideo_dl.compat._deprecated')
+ yield from ('hypervideo_dl.utils._legacy', 'hypervideo_dl.utils._deprecated')
+ yield pycryptodome_module()
+ yield from collect_submodules('websockets')
+ # These are auto-detected, but explicitly add them just in case
+ yield from ('mutagen', 'brotli', 'certifi')
+
+
+hiddenimports = list(get_hidden_imports())
+print(f'Adding imports: {hiddenimports}')
+
+excludedimports = ['youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts']