mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05: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 _get_package_paths(*root_paths, containing_folder):
|
||||||
containing_folder='yt-dlp-plugins',
|
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 (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):
|
class PluginFinder(importlib.abc.MetaPathFinder):
|
||||||
|
@ -131,8 +139,9 @@ def __init__(self, *packages):
|
||||||
)
|
)
|
||||||
|
|
||||||
def search_locations(self, fullname):
|
def search_locations(self, fullname):
|
||||||
|
|
||||||
candidate_locations = itertools.chain.from_iterable(
|
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
|
for candidate in plugin_dirs.value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue