♻ Extract printer safety warning into dependency
Renamed to firmware check, published to PyPI, on a different release cycle and version number scheme than core OctoPrint but still considered bundled via a new mechanism to mark external plugins as such. This will speed up deployment of new firmware checks in case of new printers with disabled thermal runaway protection, or stuff like the CBD firmware.
This commit is contained in:
1 parent
8a01d89049
commit
761a0fdb61
15 files changed
+31
-688
No files matched your search
@@ -38,7 +38,7 @@ def _validate_plugin(phase, plugin_info):
|
||||
|
||||
def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_entry_points=None, plugin_disabled_list=None,
|
||||
plugin_blacklist=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None,
|
||||
plugin_validators=None, compatibility_ignored_list=None):
|
||||
plugin_considered_bundled=None, plugin_validators=None, compatibility_ignored_list=None):
|
||||
"""
|
||||
Factory method for initially constructing and consecutively retrieving the :class:`~octoprint.plugin.core.PluginManager`
|
||||
singleton.
|
||||
@@ -63,6 +63,8 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
|
||||
to logging handlers
|
||||
plugin_obsolete_hooks (list): A list of hooks that have been declared obsolete. Plugins implementing them will
|
||||
not be enabled since they might depend on functionality that is no longer available.
|
||||
plugin_considered_bundled (list): A list of plugin identifiers that are considered bundled plugins even if
|
||||
installed separately.
|
||||
plugin_validators (list): A list of additional plugin validators through which to process each plugin.
|
||||
compatibility_ignored_list (list): A list of plugin keys for which it will be ignored if they are flagged as
|
||||
incompatible. This is for development purposes only and should not be used in production.
|
||||
@@ -95,6 +97,9 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
|
||||
if plugin_obsolete_hooks is None:
|
||||
plugin_obsolete_hooks = ["octoprint.comm.protocol.gcode"]
|
||||
|
||||
if plugin_considered_bundled is None:
|
||||
plugin_considered_bundled = ["firmware_check"]
|
||||
|
||||
if plugin_validators is None:
|
||||
plugin_validators = [_validate_plugin]
|
||||
else:
|
||||
@@ -108,6 +113,7 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
|
||||
plugin_blacklist=plugin_blacklist,
|
||||
plugin_restart_needing_hooks=plugin_restart_needing_hooks,
|
||||
plugin_obsolete_hooks=plugin_obsolete_hooks,
|
||||
plugin_considered_bundled=plugin_considered_bundled,
|
||||
plugin_validators=plugin_validators,
|
||||
compatibility_ignored_list=compatibility_ignored_list)
|
||||
else:
|
||||
|
||||
@@ -119,21 +119,21 @@ class PluginInfo(object):
|
||||
""" Module attribute from which to retrieve the plugin's license. """
|
||||
|
||||
attr_pythoncompat = '__plugin_pythoncompat__'
|
||||
"""
|
||||
Module attribute from which to retrieve the plugin's python compatibility string.
|
||||
|
||||
"""
|
||||
Module attribute from which to retrieve the plugin's python compatibility string.
|
||||
|
||||
If unset a default of ``>=2.7,<3`` will be assumed, meaning that the plugin will be considered compatible to
|
||||
Python 2 but not Python 3.
|
||||
|
||||
|
||||
To mark a plugin as Python 3 compatible, a string of ``>=2.7,<4`` is recommended.
|
||||
|
||||
|
||||
Bundled plugins will automatically be assumed to be compatible.
|
||||
"""
|
||||
|
||||
attr_hidden = '__plugin_hidden__'
|
||||
"""
|
||||
Module attribute from which to determine if the plugin's hidden or not.
|
||||
|
||||
|
||||
Only evaluated for bundled plugins, in order to hide them from the Plugin Manager
|
||||
and similar places.
|
||||
"""
|
||||
@@ -649,7 +649,8 @@ class PluginManager(object):
|
||||
|
||||
def __init__(self, plugin_folders, plugin_bases, plugin_entry_points, logging_prefix=None,
|
||||
plugin_disabled_list=None, plugin_blacklist=None, plugin_restart_needing_hooks=None,
|
||||
plugin_obsolete_hooks=None, plugin_validators=None, compatibility_ignored_list=None):
|
||||
plugin_obsolete_hooks=None, plugin_considered_bundled=None, plugin_validators=None,
|
||||
compatibility_ignored_list=None):
|
||||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
if logging_prefix is None:
|
||||
@@ -666,6 +667,8 @@ class PluginManager(object):
|
||||
plugin_blacklist = []
|
||||
if compatibility_ignored_list is None:
|
||||
compatibility_ignored_list = []
|
||||
if plugin_considered_bundled is None:
|
||||
plugin_considered_bundled = []
|
||||
|
||||
self.plugin_folders = plugin_folders
|
||||
self.plugin_bases = plugin_bases
|
||||
@@ -677,6 +680,7 @@ class PluginManager(object):
|
||||
self.plugin_validators = plugin_validators
|
||||
self.logging_prefix = logging_prefix
|
||||
self.compatibility_ignored_list = compatibility_ignored_list
|
||||
self.plugin_considered_bundled = plugin_considered_bundled
|
||||
|
||||
self.enabled_plugins = dict()
|
||||
self.disabled_plugins = dict()
|
||||
@@ -878,7 +882,8 @@ class PluginManager(object):
|
||||
# plugin is already defined or marked as uninstalled, ignore it
|
||||
continue
|
||||
|
||||
kwargs = dict(module_name=module_name, version=version)
|
||||
bundled = key in self.plugin_considered_bundled
|
||||
kwargs = dict(module_name=module_name, version=version, bundled=bundled)
|
||||
package_name = entry_point.dist.project_name
|
||||
try:
|
||||
entry_point_metadata = EntryPointMetadata(entry_point)
|
||||
|
||||
Reference in new issue
Block a user