plugins: dependencies are not required

What, exactly, are you going to do?
This commit is contained in:
dece 2022-11-28 23:29:22 +01:00
parent b19dd155b2
commit 1bef65ea73
9 changed files with 8 additions and 54 deletions

View file

@ -146,10 +146,6 @@ class Bot(irc.client.SimpleIRCClient, Logger):
) )
for plugin_name in plugin_names: for plugin_name in plugin_names:
module = importlib.import_module(f"edmond.plugins.{plugin_name}") module = importlib.import_module(f"edmond.plugins.{plugin_name}")
are_dependencies_ok = getattr(module, "DEPENDENCIES_FOUND", True)
if not are_dependencies_ok:
self.log_e(f"Dependencies not found for plugin {plugin_name}.")
continue
# Get plugin class name from its module name. # Get plugin class name from its module name.
class_name = ( class_name = (
"".join(map(lambda w: w.capitalize(), plugin_name.split("_"))) "".join(map(lambda w: w.capitalize(), plugin_name.split("_")))

View file

@ -1,12 +1,7 @@
import datetime import datetime
from typing import cast from typing import cast
# BS is optional and only for scrapping journee-mondiale.com, thus why we do not
# mark the dependencies flag here.
try:
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
except ImportError:
BeautifulSoup = None
from edmond.plugin import Plugin from edmond.plugin import Plugin
from edmond.plugins.plus import PlusPlugin from edmond.plugins.plus import PlusPlugin

View file

@ -1,12 +1,7 @@
import time import time
try:
import meteofrance_api as mf import meteofrance_api as mf
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin

View file

@ -1,12 +1,7 @@
import random import random
try:
from scaruffi.api import ScaruffiApi from scaruffi.api import ScaruffiApi
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin

View file

@ -1,10 +1,5 @@
try:
from translate import Translator from translate import Translator
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin

View file

@ -1,10 +1,3 @@
try:
import wolframalpha
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin

View file

@ -1,13 +1,8 @@
import time import time
from typing import cast from typing import cast
try:
import wikipedia import wikipedia
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin
from edmond.plugins.plus import PlusPlugin from edmond.plugins.plus import PlusPlugin

View file

@ -1,13 +1,8 @@
from typing import cast, Optional from typing import cast, Optional
try:
from googleapiclient.discovery import build as gapi_discovery_build from googleapiclient.discovery import build as gapi_discovery_build
from googleapiclient.errors import Error as GoogleApiError from googleapiclient.errors import Error as GoogleApiError
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin
from edmond.plugins.playlist_of_the_day import PlaylistOfTheDayPlugin from edmond.plugins.playlist_of_the_day import PlaylistOfTheDayPlugin

View file

@ -1,13 +1,8 @@
import re import re
from typing import cast, Optional from typing import cast, Optional
try:
from googleapiclient.errors import Error as GoogleApiError # type: ignore from googleapiclient.errors import Error as GoogleApiError # type: ignore
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin from edmond.plugin import Plugin
from edmond.plugins.playlist_of_the_day import PlaylistOfTheDayPlugin from edmond.plugins.playlist_of_the_day import PlaylistOfTheDayPlugin
from edmond.plugins.youtube import YoutubePlugin from edmond.plugins.youtube import YoutubePlugin