aboutsummaryrefslogtreecommitdiff
path: root/devscripts/make_lazy_extractors.py
diff options
context:
space:
mode:
authorSimon Sawicki <contact@grub4k.xyz>2024-10-13 03:50:31 +0200
committerGitHub <noreply@github.com>2024-10-13 03:50:31 +0200
commit1a830394a21a81a3e9918f9e175abc9fbb21f089 (patch)
treef8e9b7d288443923e56922947bcf1148043d98af /devscripts/make_lazy_extractors.py
parentedfd095b1917701c5046bd51f9542897c17d41a7 (diff)
[build] `make_lazy_extractors`: Force running without plugins (#11205)
Authored by: Grub4K
Diffstat (limited to 'devscripts/make_lazy_extractors.py')
-rw-r--r--devscripts/make_lazy_extractors.py27
1 files changed, 4 insertions, 23 deletions
diff --git a/devscripts/make_lazy_extractors.py b/devscripts/make_lazy_extractors.py
index d74ea202f..d288d8429 100644
--- a/devscripts/make_lazy_extractors.py
+++ b/devscripts/make_lazy_extractors.py
@@ -2,7 +2,6 @@
# Allow direct execution
import os
-import shutil
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -34,18 +33,14 @@ MODULE_TEMPLATE = read_file('devscripts/lazy_load_template.py')
def main():
- lazy_extractors_filename = get_filename_args(default_outfile='yt_dlp/extractor/lazy_extractors.py')
- if os.path.exists(lazy_extractors_filename):
- os.remove(lazy_extractors_filename)
+ os.environ['YTDLP_NO_PLUGINS'] = 'true'
+ os.environ['YTDLP_NO_LAZY_EXTRACTORS'] = 'true'
- _ALL_CLASSES = get_all_ies() # Must be before import
+ lazy_extractors_filename = get_filename_args(default_outfile='yt_dlp/extractor/lazy_extractors.py')
- import yt_dlp.plugins
+ from yt_dlp.extractor.extractors import _ALL_CLASSES
from yt_dlp.extractor.common import InfoExtractor, SearchInfoExtractor
- # Filter out plugins
- _ALL_CLASSES = [cls for cls in _ALL_CLASSES if not cls.__module__.startswith(f'{yt_dlp.plugins.PACKAGE_NAME}.')]
-
DummyInfoExtractor = type('InfoExtractor', (InfoExtractor,), {'IE_NAME': NO_ATTR})
module_src = '\n'.join((
MODULE_TEMPLATE,
@@ -58,20 +53,6 @@ def main():
write_file(lazy_extractors_filename, f'{module_src}\n')
-def get_all_ies():
- PLUGINS_DIRNAME = 'ytdlp_plugins'
- BLOCKED_DIRNAME = f'{PLUGINS_DIRNAME}_blocked'
- if os.path.exists(PLUGINS_DIRNAME):
- # os.rename cannot be used, e.g. in Docker. See https://github.com/yt-dlp/yt-dlp/pull/4958
- shutil.move(PLUGINS_DIRNAME, BLOCKED_DIRNAME)
- try:
- from yt_dlp.extractor.extractors import _ALL_CLASSES
- finally:
- if os.path.exists(BLOCKED_DIRNAME):
- shutil.move(BLOCKED_DIRNAME, PLUGINS_DIRNAME)
- return _ALL_CLASSES
-
-
def extra_ie_code(ie, base=None):
for var in STATIC_CLASS_PROPERTIES:
val = getattr(ie, var)