From 961abfbbac62e40e89f2d3c9be06e47b40104f79 Mon Sep 17 00:00:00 2001 From: Chris Warrick Date: Mon, 15 Jan 2024 01:05:48 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20#3741=20=E2=80=94=20symlink=20support=20i?= =?UTF-8?q?n=20new=20plugin=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.txt | 1 + nikola/plugin_manager.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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