Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/modules/addon_utils.py')
-rw-r--r--release/scripts/modules/addon_utils.py45
1 files changed, 35 insertions, 10 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index 5aed0581ea9..22936f4c209 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####
-# <pep8 compliant>
+# <pep8-80 compliant>
__all__ = (
"paths",
@@ -26,7 +26,7 @@ __all__ = (
"disable",
"reset_all",
"module_bl_info",
-)
+ )
import bpy as _bpy
@@ -129,7 +129,12 @@ def modules(module_cache):
error_duplicates = True
elif mod.__time__ != os.path.getmtime(mod_path):
- print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path)
+ print("reloading addon:",
+ mod_name,
+ mod.__time__,
+ os.path.getmtime(mod_path),
+ mod_path,
+ )
del module_cache[mod_name]
mod = None
@@ -144,7 +149,9 @@ def modules(module_cache):
del modules_stale
mod_list = list(module_cache.values())
- mod_list.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name']))
+ mod_list.sort(key=lambda mod: (mod.bl_info['category'],
+ mod.bl_info['name'],
+ ))
return mod_list
@@ -164,8 +171,9 @@ def check(module_name):
loaded_state = mod and getattr(mod, "__addon_enabled__", Ellipsis)
if loaded_state is Ellipsis:
- print("Warning: addon-module %r found module but without"
- " __addon_enabled__ field, possible name collision from file: %r" %
+ print("Warning: addon-module %r found module "
+ "but without __addon_enabled__ field, "
+ "possible name collision from file: %r" %
(module_name, getattr(mod, "__file__", "<unknown>")))
loaded_state = False
@@ -208,7 +216,8 @@ def enable(module_name, default_set=True):
return None
mod.__addon_enabled__ = False
- # Split registering up into 3 steps so we can undo if it fails par way through
+ # Split registering up into 3 steps so we can undo
+ # if it fails par way through.
# 1) try import
try:
mod = __import__(module_name)
@@ -255,8 +264,9 @@ def disable(module_name, default_set=True):
import sys
mod = sys.modules.get(module_name)
- # possible this addon is from a previous session and didnt load a module this time.
- # so even if the module is not found, still disable the addon in the user prefs.
+ # possible this addon is from a previous session and didnt load a
+ # module this time. So even if the module is not found, still disable
+ # the addon in the user prefs.
if mod:
mod.__addon_enabled__ = False
@@ -311,7 +321,22 @@ def reset_all(reload_scripts=False):
disable(mod_name)
-def module_bl_info(mod, info_basis={"name": "", "author": "", "version": (), "blender": (), "api": 0, "location": "", "description": "", "wiki_url": "", "tracker_url": "", "support": 'COMMUNITY', "category": "", "warning": "", "show_expanded": False}):
+def module_bl_info(mod, info_basis={"name": "",
+ "author": "",
+ "version": (),
+ "blender": (),
+ "api": 0,
+ "location": "",
+ "description": "",
+ "wiki_url": "",
+ "tracker_url": "",
+ "support": 'COMMUNITY',
+ "category": "",
+ "warning": "",
+ "show_expanded": False,
+ }
+ ):
+
addon_info = getattr(mod, "bl_info", {})
# avoid re-initializing