diff options
author | Simon Sawicki <contact@grub4k.xyz> | 2023-01-06 20:01:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 00:31:00 +0530 |
commit | 773c272d66d0874eae76795a3742f3eec1a950a8 (patch) | |
tree | b5603597cdb660094889b79561dc7c9c01f5654c /yt_dlp/plugins.py | |
parent | c3366fdfd000a25fd405737b75b47324a6e3eca5 (diff) |
Fix config locations (#5933)
Bug in 8e40b9d1ec132ae1bcac50b3ee520ece46ac9c55
Closes #5953
Authored by: Grub4k, coletdjnz, pukkandan
Diffstat (limited to 'yt_dlp/plugins.py')
-rw-r--r-- | yt_dlp/plugins.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/yt_dlp/plugins.py b/yt_dlp/plugins.py index 7d2226d0f..ff5ab9d5e 100644 --- a/yt_dlp/plugins.py +++ b/yt_dlp/plugins.py @@ -5,7 +5,6 @@ import importlib.machinery import importlib.util import inspect import itertools -import os import pkgutil import sys import traceback @@ -14,11 +13,11 @@ from pathlib import Path from zipfile import ZipFile from .compat import functools # isort: split -from .compat import compat_expanduser from .utils import ( get_executable_path, get_system_config_dirs, get_user_config_dirs, + orderedSet, write_string, ) @@ -57,7 +56,7 @@ class PluginFinder(importlib.abc.MetaPathFinder): candidate_locations = [] def _get_package_paths(*root_paths, containing_folder='plugins'): - for config_dir in map(Path, root_paths): + for config_dir in orderedSet(map(Path, root_paths), lazy=True): plugin_dir = config_dir / containing_folder if not plugin_dir.is_dir(): continue @@ -65,15 +64,15 @@ class PluginFinder(importlib.abc.MetaPathFinder): # Load from yt-dlp config folders candidate_locations.extend(_get_package_paths( - *get_user_config_dirs('yt-dlp'), *get_system_config_dirs('yt-dlp'), + *get_user_config_dirs('yt-dlp'), + *get_system_config_dirs('yt-dlp'), containing_folder='plugins')) # Load from yt-dlp-plugins folders candidate_locations.extend(_get_package_paths( get_executable_path(), - compat_expanduser('~'), - '/etc', - os.getenv('XDG_CONFIG_HOME') or compat_expanduser('~/.config'), + *get_user_config_dirs(''), + *get_system_config_dirs(''), containing_folder='yt-dlp-plugins')) candidate_locations.extend(map(Path, sys.path)) # PYTHONPATH |