diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-18 09:41:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-18 09:41:46 +0400 |
commit | 8dd72c476e51ee457fdd98625eff7a1afc88f49e (patch) | |
tree | 2884f282fe979811042778f39a97636502c43177 /release/scripts/modules/addon_utils.py | |
parent | 13e82ff8e1ab8b3fb03da026325a150cb7cf4ea0 (diff) |
fix [#28005] Python Add-Ons are constantly reloaded if twice in the path
Addons are checked for their timestamps and reloaded when it changes but this failed when, 2 addons had the same name since different times caused 2 reloads on every redraw.
Now when duplicate addons are in the path now give a error message in the UI and print path conflict in the console and don't thrash reloading.
Diffstat (limited to 'release/scripts/modules/addon_utils.py')
-rw-r--r-- | release/scripts/modules/addon_utils.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 07f1dc618dc..cf74282d064 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -31,6 +31,8 @@ __all__ = ( import bpy as _bpy +error_duplicates = False + def paths(): # RELEASE SCRIPTS: official scripts distributed in Blender releases paths = _bpy.utils.script_paths("addons") @@ -47,8 +49,11 @@ def paths(): def modules(module_cache): + global error_duplicates import os + error_duplicates = False + path_list = paths() # fake module importing @@ -117,7 +122,12 @@ def modules(module_cache): modules_stale -= {mod_name} mod = module_cache.get(mod_name) if mod: - if mod.__time__ != os.path.getmtime(mod_path): + if mod.__file__ != mod_path: + print("multiple addons with the same name:\n %r\n %r" % + (mod.__file__, mod_path)) + 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) del module_cache[mod_name] mod = None |