py addons: much faster scanning of addons by only parsing the dictionary rather then...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 2 Aug 2010 12:35:32 +0000 (12:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 2 Aug 2010 12:35:32 +0000 (12:35 +0000)
release/scripts/ui/space_userpref.py

index cc95b49f41db9eb273fdab0610b20842e1ee772c..30d84577b3dc9a3512d3309da468c9b02615c366 100644 (file)
@@ -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()