Skip to content

Commit

Permalink
plugins: don't search in ~/.sopel/modules by default any more
Browse files Browse the repository at this point in the history
Also reindented the touched docstring to follow our current conventions
re: block roles (e.g. `.. seealso::`).

Removed unnecessary `list(ListAttribute)` typecast.
  • Loading branch information
dgw committed Jun 26, 2021
1 parent 0ee5974 commit c783635
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
28 changes: 12 additions & 16 deletions sopel/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* extra directories defined in the settings
* homedir's ``plugins`` directory
* homedir's ``modules`` directory
* ``sopel.plugins`` setuptools entry points
* ``sopel_modules``'s subpackages
* ``sopel.modules``'s core plugins
Expand Down Expand Up @@ -137,33 +136,30 @@ def enumerate_plugins(settings):
.. seealso::
The find functions used are:
The find functions used are:
* :func:`find_internal_plugins` for internal plugins
* :func:`find_sopel_modules_plugins` for ``sopel_modules.*`` plugins
* :func:`find_entry_point_plugins` for plugins exposed by setuptools
entry points
* :func:`find_directory_plugins` for plugins in ``$homedir/modules``,
``$homedir/plugins``, and in extra directories, as defined by
``settings.core.extra``
* :func:`find_internal_plugins` for internal plugins
* :func:`find_sopel_modules_plugins` for ``sopel_modules.*`` plugins
* :func:`find_entry_point_plugins` for plugins exposed by setuptools
entry points
* :func:`find_directory_plugins` for plugins in ``$homedir/plugins``,
and in extra directories as defined by ``settings.core.extra``
.. versionchanged:: 7.0
.. versionchanged:: 8.0
Previously, plugins were called "modules", so this would load plugins
from the ``$homedir/modules`` directory. Now it also loads plugins
from the ``$homedir/plugins`` directory.
Looks in ``$homedir/plugins`` instead of the ``$homedir/modules``
directory, reflecting Sopel's shift away from calling them "modules".
"""
from_internals = find_internal_plugins()
from_sopel_modules = find_sopel_modules_plugins()
from_entry_points = find_entry_point_plugins()
# load from directories
source_dirs = [
os.path.join(settings.homedir, 'modules'),
os.path.join(settings.homedir, 'plugins'),
]
if settings.core.extra:
source_dirs = source_dirs + list(settings.core.extra)
source_dirs = source_dirs + settings.core.extra

from_directories = [
find_directory_plugins(source_dir)
Expand Down Expand Up @@ -205,7 +201,7 @@ def get_usable_plugins(settings):
contains one and only one plugin per unique name, using a specific order:
* extra directories defined in the settings
* homedir's ``modules`` directory
* homedir's ``plugins`` directory
* ``sopel.plugins`` setuptools entry points
* ``sopel_modules``'s subpackages
* ``sopel.modules``'s core plugins
Expand Down
2 changes: 1 addition & 1 deletion sopel/plugins/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class PyFilePlugin(PyModulePlugin):
``__init__.py`` file, and behaves like a :class:`PyModulePlugin`::
>>> from sopel.plugins.handlers import PyFilePlugin
>>> plugin = PyFilePlugin('/home/sopel/.sopel/modules/custom.py')
>>> plugin = PyFilePlugin('/home/sopel/.sopel/plugins/custom.py')
>>> plugin.load()
>>> plugin.name
'custom'
Expand Down

0 comments on commit c783635

Please sign in to comment.