✨ Blacklist: support pythonversions & pluginversions
Also deprecate plain versions key. That way we can now easier define blacklisted version ranges and also limit blacklisting to specific python versions (on top of OctoPrint and plugin versions).
This commit is contained in:
1 parent
61ed63d233
commit
17958a460d
3 files changed
+32
-9
No files matched your search
@@ -837,11 +837,27 @@ class PluginManager(object):
|
||||
if plugin_considered_bundled is None:
|
||||
plugin_considered_bundled = []
|
||||
|
||||
processed_blacklist = []
|
||||
for entry in plugin_blacklist:
|
||||
if isinstance(entry, tuple):
|
||||
key, version = entry
|
||||
try:
|
||||
processed_blacklist.append(
|
||||
(key, pkg_resources.Requirement.parse(version))
|
||||
)
|
||||
except Exception:
|
||||
self.logger.warning(
|
||||
"Invalid version requirement {} for blacklist "
|
||||
"entry {}, ignoring".format(version, key)
|
||||
)
|
||||
else:
|
||||
processed_blacklist.append(entry)
|
||||
|
||||
self.plugin_folders = plugin_folders
|
||||
self.plugin_bases = plugin_bases
|
||||
self.plugin_entry_points = plugin_entry_points
|
||||
self.plugin_disabled_list = plugin_disabled_list
|
||||
self.plugin_blacklist = plugin_blacklist
|
||||
self.plugin_blacklist = processed_blacklist
|
||||
self.plugin_restart_needing_hooks = plugin_restart_needing_hooks
|
||||
self.plugin_obsolete_hooks = plugin_obsolete_hooks
|
||||
self.plugin_validators = plugin_validators
|
||||
@@ -1310,7 +1326,7 @@ class PluginManager(object):
|
||||
def matches_plugin(entry):
|
||||
if isinstance(entry, (tuple, list)) and len(entry) == 2:
|
||||
entry_key, entry_version = entry
|
||||
return entry_key == key and entry_version == version
|
||||
return entry_key == key and version in entry_version
|
||||
return False
|
||||
|
||||
return any(map(lambda entry: matches_plugin(entry), self.plugin_blacklist))
|
||||
|
||||
Reference in new issue
Block a user