[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30976] trunk/blender/release/scripts/ui/ space_userpref.py: py addons: much faster scanning of addons by only parsing the dictionary rather then the entire file .
Campbell Barton
ideasman42 at gmail.com
Mon Aug 2 14:35:32 CEST 2010
Revision: 30976
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30976
Author: campbellbarton
Date: 2010-08-02 14:35:32 +0200 (Mon, 02 Aug 2010)
Log Message:
-----------
py addons: much faster scanning of addons by only parsing the dictionary rather then the entire file.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_userpref.py
Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py 2010-08-02 12:30:41 UTC (rev 30975)
+++ trunk/blender/release/scripts/ui/space_userpref.py 2010-08-02 12:35:32 UTC (rev 30976)
@@ -842,12 +842,23 @@
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()
More information about the Bf-blender-cvs
mailing list