fix no-external not including PYTHONPATH

pull/11305/head
coletdjnz 4 weeks ago
parent d48d00d064
commit 37aed891c4
No known key found for this signature in database
GPG Key ID: 91984263BB39894A

@ -109,9 +109,17 @@ def external_plugin_paths():
containing_folder='yt-dlp-plugins',
)
# Load from PYTHONPATH folders
yield from internal_plugin_paths()
def internal_plugin_paths():
# Always try load from PYTHONPATH folders
yield from (path for path in map(Path, sys.path) if path != _BASE_PACKAGE_PATH)
# yield from _get_package_paths(*sys.path, containing_folder='')
def candidate_plugin_paths(candidate):
yield from Path(candidate).iterdir()
yield from internal_plugin_paths()
class PluginFinder(importlib.abc.MetaPathFinder):
@ -131,8 +139,9 @@ class PluginFinder(importlib.abc.MetaPathFinder):
)
def search_locations(self, fullname):
candidate_locations = itertools.chain.from_iterable(
external_plugin_paths() if candidate == 'external' else Path(candidate).iterdir()
external_plugin_paths() if candidate == 'external' else candidate_plugin_paths(candidate)
for candidate in plugin_dirs.value
)

Loading…
Cancel
Save