summaryrefslogtreecommitdiffstats
path: root/yt_dlp/__pyinstaller
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:49:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:49:24 +0000
commit2415e66f889f38503b73e8ebc5f43ca342390e5c (patch)
treeac48ab69d1d96bae3d83756134921e0d90593aa5 /yt_dlp/__pyinstaller
parentInitial commit. (diff)
downloadyt-dlp-2415e66f889f38503b73e8ebc5f43ca342390e5c.tar.xz
yt-dlp-2415e66f889f38503b73e8ebc5f43ca342390e5c.zip
Adding upstream version 2024.03.10.upstream/2024.03.10
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.py34
2 files changed, 39 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..7c3dbfb
--- /dev/null
+++ b/yt_dlp/__pyinstaller/hook-yt_dlp.py
@@ -0,0 +1,34 @@
+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']