Skip to content

Commit

Permalink
Revert "🧪 plugin system test"
Browse files Browse the repository at this point in the history
This reverts commit 53d345d.
  • Loading branch information
Joshix-1 committed May 26, 2024
1 parent fb9b8d9 commit 04ddf88
Show file tree
Hide file tree
Showing 51 changed files with 9 additions and 52 deletions.
18 changes: 0 additions & 18 deletions an_website/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from configparser import ConfigParser
from functools import partial
from hashlib import sha256
from importlib.metadata import EntryPoints, entry_points
from multiprocessing.process import _children # type: ignore[attr-defined]
from socket import socket
from typing import Any, Final, TypedDict, TypeGuard, cast
Expand Down Expand Up @@ -148,23 +147,6 @@ def get_module_infos() -> str | tuple[ModuleInfo, ...]:
module_infos.extend(_module_infos)
loaded_modules.append(module_name)

plugin_entry_points: EntryPoints = entry_points(group='an_website-modules', name="get_module_infos")
for entry_point in plugin_entry_points:
if entry_point.module in IGNORED_MODULES:
continue
try:
module_infos.extend(entry_point.load()())
except Exception as exc:
raise ValueError(f"Failed to load entry point {entry_point}, add {entry_point.module!r} to IGNORED_MODULES") from exc
else:
loaded_modules.append(entry_point.module)
LOGGER.info(
(
"Found module_infos in external module %r"
),
entry_point.module,
)

if len(errors) > 0:
if sys.flags.dev_mode:
# exit to make sure it gets fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,20 @@

import os
from os.path import abspath, dirname
from typing import Final, Iterable
from typing import Final

from tornado.web import RedirectHandler

from an_website.utils.static_file_handling import CachedStaticFileHandler
from an_website.utils.utils import ModuleInfo, PageInfo
from ..utils.static_file_handling import CachedStaticFileHandler
from ..utils.utils import ModuleInfo, PageInfo
from .soundboard import SoundboardHTMLHandler, SoundboardRSSHandler

__version__ = "0.1.0"

DIR: Final = abspath(dirname(__file__))


def get_module_infos() -> Iterable[ModuleInfo]:
def get_module_info() -> ModuleInfo:
"""Create and return the ModuleInfo for this module."""
yield ModuleInfo(
return ModuleInfo(
name="Känguru-Soundboard",
short_name="Soundboard",
description=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import orjson as json
import regex

from an_website.utils.static_file_handling import hash_file
from an_website.utils.utils import name_to_id, replace_umlauts
from ..utils.static_file_handling import hash_file
from ..utils.utils import name_to_id, replace_umlauts

DIR: Final = os.path.dirname(__file__)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from tornado.web import HTTPError

from an_website.utils.request_handler import HTMLRequestHandler
from ..utils.request_handler import HTMLRequestHandler
from .data import (
ALL_SOUNDS,
MAIN_PAGE_INFO,
Expand Down
23 changes: 0 additions & 23 deletions plugins/soundboard/pyproject.toml

This file was deleted.

0 comments on commit 04ddf88

Please sign in to comment.