summaryrefslogtreecommitdiffstats
path: root/yt_dlp/__pyinstaller
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:37:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:37:42 +0000
commitc7bab7c39fd51c0812f70020172766303191bc01 (patch)
tree56c05fbdd4fc47409d48ba318a4b621a7b0d299a /yt_dlp/__pyinstaller
parentInitial commit. (diff)
downloadyt-dlp-c7bab7c39fd51c0812f70020172766303191bc01.tar.xz
yt-dlp-c7bab7c39fd51c0812f70020172766303191bc01.zip
Adding upstream version 2023.03.04.upstream/2023.03.04upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/__pyinstaller')
-rw-r--r--yt_dlp/__pyinstaller/__init__.py5
-rw-r--r--yt_dlp/__pyinstaller/hook-yt_dlp.py31
2 files changed, 36 insertions, 0 deletions
diff --git a/yt_dlp/__pyinstaller/__init__.py b/yt_dlp/__pyinstaller/__init__.py
new file mode 100644
index 0000000..1c52aad
--- /dev/null
+++ b/yt_dlp/__pyinstaller/__init__.py
@@ -0,0 +1,5 @@
+import os
+
+
+def get_hook_dirs():
+ return [os.path.dirname(__file__)]
diff --git a/yt_dlp/__pyinstaller/hook-yt_dlp.py b/yt_dlp/__pyinstaller/hook-yt_dlp.py
new file mode 100644
index 0000000..63dcdff
--- /dev/null
+++ b/yt_dlp/__pyinstaller/hook-yt_dlp.py
@@ -0,0 +1,31 @@
+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 'yt_dlp.compat._legacy'
+ 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']