Skip to content

Commit

Permalink
Fix #3741 — symlink support in new plugin manager (#3742)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwpolska authored Jan 16, 2024
1 parent cec44ae commit f260a7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions nikola/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -102,9 +104,13 @@ 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()
items = list(base_folder.iterdir())
plugin_folders.extend([item for item in items if item.is_dir() and item.name != "__pycache__"])
plugin_files.extend([item for item in items if item.suffix == ".plugin" and not item.is_dir()])

for plugin_file in plugin_files:
source_dir = plugin_file.parent
Expand Down

0 comments on commit f260a7b

Please sign in to comment.