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:
authorCampbell Barton <ideasman42@gmail.com>2011-05-04 12:44:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-04 12:44:08 +0400
commit5a0dca41e5aed566ce6427c863c2f3072f7d044c (patch)
treefd6b22154d6fb4c1ab2914cafa29377e6f25346f /release/scripts/startup/bl_ui/space_userpref.py
parent7c5d6c9c39cb7caf1c334295e60f0454b270bfd2 (diff)
fix 2 bugs with addon installation
- installing an addon which creates a new script directory didn't add this to the sys.path. - installing the addon was meant to set the search string to the addon name but was broken.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_userpref.py')
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index a8d8c412063..5c28f12b7f1 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1106,7 +1106,8 @@ class WM_OT_addon_install(bpy.types.Operator):
del pyfile_dir
# done checking for exceptional case
- contents = set(os.listdir(path_addons))
+ addon_files_old = set(os.listdir(path_addons))
+ addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)}
#check to see if the file is in compressed format (.zip)
if zipfile.is_zipfile(pyfile):
@@ -1155,11 +1156,13 @@ class WM_OT_addon_install(bpy.types.Operator):
traceback.print_exc()
return {'CANCELLED'}
+ addons_new = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} - addons_old
+ addons_new.discard("modules")
+
# disable any addons we may have enabled previously and removed.
# this is unlikely but do just incase. bug [#23978]
- addons_new = set(os.listdir(path_addons)) - contents
for new_addon in addons_new:
- addon_utils.disable(os.path.splitext(new_addon)[0])
+ addon_utils.disable(new_addon)
# possible the zip contains multiple addons, we could disallow this
# but for now just use the first
@@ -1172,6 +1175,9 @@ class WM_OT_addon_install(bpy.types.Operator):
context.window_manager.addon_search = info["name"]
break
+ # incase a new module path was created to install this addon.
+ bpy.utils.refresh_script_paths()
+
# TODO, should not be a warning.
# self.report({'WARNING'}, "File installed to '%s'\n" % path_dest)
return {'FINISHED'}