mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix #1344 move PLUGIN_PATH -> PLUGIN_PATHS
Pelican uses *_PATHS names for settings that represent a list of paths.
This commit is contained in:
parent
d635a347d1
commit
21882fd4a0
4 changed files with 18 additions and 13 deletions
|
|
@ -21,10 +21,10 @@ Alternatively, another method is to import them and add them to the list::
|
|||
PLUGINS = [myplugin,]
|
||||
|
||||
If your plugins are not in an importable path, you can specify a list of paths
|
||||
via the ``PLUGIN_PATH`` setting. As shown in the following example, paths in
|
||||
the ``PLUGIN_PATH`` list can be absolute or relative to the settings file::
|
||||
via the ``PLUGIN_PATHS`` setting. As shown in the following example, paths in
|
||||
the ``PLUGIN_PATHS`` list can be absolute or relative to the settings file::
|
||||
|
||||
PLUGIN_PATH = ["plugins", "/srv/pelican/plugins"]
|
||||
PLUGIN_PATHS = ["plugins", "/srv/pelican/plugins"]
|
||||
PLUGINS = ["assets", "liquid_tags", "sitemap"]
|
||||
|
||||
Where to find plugins
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ Setting name (followed by default value, if any)
|
|||
not. Only set this to ``True`` when developing/testing and only
|
||||
if you fully understand the effect it can have on links/feeds.
|
||||
``PLUGINS = []`` The list of plugins to load. See :ref:`plugins`.
|
||||
``PLUGIN_PATHS = []`` A list of directories where to look for plugins. See :ref:`plugins`.
|
||||
``SITENAME = 'A Pelican Blog'`` Your site name
|
||||
``SITEURL`` Base URL of your website. Not defined by default,
|
||||
so it is best to specify your SITEURL; if you do not, feeds
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ class Pelican(object):
|
|||
|
||||
def init_plugins(self):
|
||||
self.plugins = []
|
||||
logger.debug('Temporarily adding PLUGIN_PATH to system path')
|
||||
logger.debug('Temporarily adding PLUGIN_PATHS to system path')
|
||||
_sys_path = sys.path[:]
|
||||
for pluginpath in self.settings['PLUGIN_PATH']:
|
||||
for pluginpath in self.settings['PLUGIN_PATHS']:
|
||||
sys.path.insert(0, pluginpath)
|
||||
for plugin in self.settings['PLUGINS']:
|
||||
# if it's a string, then import it
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ DEFAULT_CONFIG = {
|
|||
'ARTICLE_PERMALINK_STRUCTURE': '',
|
||||
'TYPOGRIFY': False,
|
||||
'SUMMARY_MAX_LENGTH': 50,
|
||||
'PLUGIN_PATH': [],
|
||||
'PLUGIN_PATHS': [],
|
||||
'PLUGINS': [],
|
||||
'PYGMENTS_RST_OPTIONS': {},
|
||||
'TEMPLATE_PAGES': {},
|
||||
|
|
@ -147,13 +147,17 @@ def read_settings(path=None, override=None):
|
|||
if p not in ('THEME') or os.path.exists(absp):
|
||||
local_settings[p] = absp
|
||||
|
||||
if isinstance(local_settings['PLUGIN_PATH'], six.string_types):
|
||||
logger.warning("Defining %s setting as string has been deprecated (should be a list)" % 'PLUGIN_PATH')
|
||||
local_settings['PLUGIN_PATH'] = [local_settings['PLUGIN_PATH']]
|
||||
else:
|
||||
if 'PLUGIN_PATH' in local_settings and local_settings['PLUGIN_PATH'] is not None:
|
||||
local_settings['PLUGIN_PATH'] = [os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(path), pluginpath)))
|
||||
if not isabs(pluginpath) else pluginpath for pluginpath in local_settings['PLUGIN_PATH']]
|
||||
if 'PLUGIN_PATH' in local_settings:
|
||||
logger.warning('PLUGIN_PATH setting has been replaced by '
|
||||
'PLUGIN_PATHS, moving it to the new setting name.')
|
||||
local_settings['PLUGIN_PATHS'] = local_settings['PLUGIN_PATH']
|
||||
del local_settings['PLUGIN_PATH']
|
||||
if isinstance(local_settings['PLUGIN_PATHS'], six.string_types):
|
||||
logger.warning("Defining %s setting as string has been deprecated (should be a list)" % 'PLUGIN_PATHS')
|
||||
local_settings['PLUGIN_PATHS'] = [local_settings['PLUGIN_PATHS']]
|
||||
elif local_settings['PLUGIN_PATHS'] is not None:
|
||||
local_settings['PLUGIN_PATHS'] = [os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(path), pluginpath)))
|
||||
if not isabs(pluginpath) else pluginpath for pluginpath in local_settings['PLUGIN_PATHS']]
|
||||
else:
|
||||
local_settings = copy.deepcopy(DEFAULT_CONFIG)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue