Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: don't search in ~/.sopel/modules by default any more #2119

Merged
merged 1 commit into from
Jul 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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