mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-01-13 20:01:57 +01:00
fix no-external not including PYTHONPATH
This commit is contained in:
parent
d48d00d064
commit
37aed891c4
1 changed files with 12 additions and 3 deletions
|
@ -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…
Reference in a new issue