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>2010-08-02 16:35:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-02 16:35:32 +0400
commit486e00a3edc22f1fc6ac57ea88d4b6e3f306df2c (patch)
tree0cca6bdbd9d9abdd8954e3099da893e4fa4574b3 /release/scripts/ui/space_userpref.py
parent200fb4a286296d755d106bacad455b37ec0d6644 (diff)
py addons: much faster scanning of addons by only parsing the dictionary rather then the entire file.
Diffstat (limited to 'release/scripts/ui/space_userpref.py')
-rw-r--r--release/scripts/ui/space_userpref.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index cc95b49f41d..30d84577b3d 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -842,12 +842,23 @@ class USERPREF_PT_addons(bpy.types.Panel):
if 1:
# fake module importing
- def fake_module(mod_name, mod_path, speedy=False):
- print("fake_module", mod_name, mod_path)
+ def fake_module(mod_name, mod_path, speedy=True):
+ if bpy.app.debug:
+ print("fake_module", mod_name, mod_path)
import ast
ModuleType = type(ast)
if speedy:
- pass
+ lines = []
+ line_iter = iter(open(mod_path, "r"))
+ l = ""
+ while not l.startswith("bl_addon_info"):
+ l = line_iter.readline()
+ while l.rstrip():
+ lines.append(l)
+ l = line_iter.readline()
+ del line_iter
+ data = "".join(lines)
+
else:
data = open(mod_path, "r").read()