[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30973] trunk/blender/release/scripts/ui/ space_userpref.py: fix for parsing scripts
Campbell Barton
ideasman42 at gmail.com
Mon Aug 2 14:07:50 CEST 2010
Revision: 30973
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30973
Author: campbellbarton
Date: 2010-08-02 14:07:50 +0200 (Mon, 02 Aug 2010)
Log Message:
-----------
fix for parsing scripts
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 10:59:06 UTC (rev 30972)
+++ trunk/blender/release/scripts/ui/space_userpref.py 2010-08-02 12:07:50 UTC (rev 30973)
@@ -842,19 +842,24 @@
if 1:
# fake module importing
- def fake_module(mod_name, mod_path):
+ def fake_module(mod_name, mod_path, speedy=False):
+ print("fake_module", mod_name, mod_path)
import ast
ModuleType = type(ast)
- data = open(mod_path, "r").read()
+ if speedy:
+ pass
+ else:
+ data = open(mod_path, "r").read()
+
ast_data = ast.parse(data, filename=mod_path)
body_info = None
for body in ast_data.body:
if body.__class__ == ast.Assign:
if len(body.targets) == 1:
- if body.targets[0].id == "bl_addon_info":
+ if getattr(body.targets[0], "id", "") == "bl_addon_info":
body_info = body
break
-
+
if body_info:
mod = ModuleType(mod_name)
mod.bl_addon_info = ast.literal_eval(body.value)
More information about the Bf-blender-cvs
mailing list