diff --git a/CHANGES.txt b/CHANGES.txt index 50f5b6ebac..0cb4c06ce2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,7 @@ Features Bugfixes -------- +* Fix the new plugin manager not loading plugins if the plugin folder is a symlink (Issue #3741) * Fix the ``nikola plugin`` command not working (Issue #3736) New in v8.3.0 diff --git a/nikola/plugin_manager.py b/nikola/plugin_manager.py index 5c1a29a103..c1d21e50eb 100644 --- a/nikola/plugin_manager.py +++ b/nikola/plugin_manager.py @@ -31,6 +31,8 @@ import importlib.util import time import sys + +from collections import deque from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Optional, Type, TYPE_CHECKING, Set @@ -102,9 +104,15 @@ def locate_plugins(self) -> List[PluginCandidate]: """Locate plugins in plugin_places.""" self.candidates = [] + plugin_folders: deque = deque([place for place in self.plugin_places if place.exists() and place.is_dir()]) plugin_files: List[Path] = [] - for place in self.plugin_places: - plugin_files += place.rglob("*.plugin") + while plugin_folders: + base_folder = plugin_folders.popleft() + for item in base_folder.iterdir(): + if item.is_dir(): + plugin_folders.append(item) + elif item.suffix == ".plugin": + plugin_files.append(item) for plugin_file in plugin_files: source_dir = plugin_file.parent