addons: disable addons with versions below 2.8

This commit is contained in:
Campbell Barton 2018-07-03 07:58:10 +02:00
parent 7a0750016e
commit 1ff5cc8c1a
2 changed files with 19 additions and 1 deletions

View File

@ -351,6 +351,16 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
_addon_remove(module_name)
return None
# 1.1) fail when add-on is too old
# This is a temporary 2.8x migration check, so we can manage addons that are supported.
try:
print(mod.bl_info.get("blender", (0, 0, 0)))
if mod.bl_info.get("blender", (0, 0, 0)) < (2, 80, 0):
raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring")
except Exception as ex:
handle_error(ex)
return None
# 2) try register collected modules
# removed, addons need to handle own registration now.

View File

@ -1473,7 +1473,15 @@ class USERPREF_PT_addons(Panel):
sub = row.row()
sub.active = is_enabled
sub.label(text="%s: %s" % (info["category"], info["name"]))
if info["warning"]:
# WARNING: 2.8x exception, may be removed
# use disabled state for old add-ons, chances are they are broken.
if info.get("blender", (0,)) < (2, 80):
sub.label(text="upgrade to 2.8x required")
sub.label(icon='ERROR')
# Remove code above after 2.8x migration is complete.
elif info["warning"]:
sub.label(icon='ERROR')
# icon showing support level.