mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	[build] make_lazy_extractors: Force running without plugins (#11205)
				
					
				
			Authored by: Grub4K
This commit is contained in:
		| @@ -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(): | ||||
|     os.environ['YTDLP_NO_PLUGINS'] = 'true' | ||||
|     os.environ['YTDLP_NO_LAZY_EXTRACTORS'] = 'true' | ||||
| 
 | ||||
|     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) | ||||
| 
 | ||||
|     _ALL_CLASSES = get_all_ies()  # Must be before import | ||||
| 
 | ||||
|     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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Simon Sawicki
					Simon Sawicki