[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25143] trunk/blender/release/scripts/ modules/bpy/__init__.py: committed script time checks by mistake, only use with -d debug flag

Campbell Barton ideasman42 at gmail.com
Sat Dec 5 21:50:19 CET 2009


Revision: 25143
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25143
Author:   campbellbarton
Date:     2009-12-05 21:50:19 +0100 (Sat, 05 Dec 2009)

Log Message:
-----------
committed script time checks by mistake, only use with -d debug flag

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy/__init__.py

Modified: trunk/blender/release/scripts/modules/bpy/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/__init__.py	2009-12-05 20:45:51 UTC (rev 25142)
+++ trunk/blender/release/scripts/modules/bpy/__init__.py	2009-12-05 20:50:19 UTC (rev 25143)
@@ -31,21 +31,23 @@
 # fake operator module
 ops = _ops_module.ops_fake_module
 
-import time
+import sys
+DEBUG = ("-d" in sys.argv)
 
 def load_scripts(reload_scripts=False):
     import os
-    import sys
     import traceback
+    import time
     
     
-    tt = time.time()
+    t_main = time.time()
 
     def test_import(module_name):
         try:
             t = time.time()
             ret= __import__(module_name)
-            print("time %s %.4f" % (module_name, time.time() - t))
+            if DEBUG:
+                print("time %s %.4f" % (module_name, time.time() - t))
             return ret
         except:
             traceback.print_exc()
@@ -70,9 +72,10 @@
                     if reload_scripts and mod:
                         print("Reloading:", mod)
                         reload(mod)
-    
-    print("Time %.4f" % (time.time() - tt))
 
+    if DEBUG:
+        print("Time %.4f" % (time.time() - t_main))
+
 def _main():
 
     # a bit nasty but this prevents help() and input() from locking blender
@@ -81,7 +84,8 @@
     import sys
     sys.stdin = None
 
-    if "-d" in sys.argv: # Enable this to measure startup speed
+    # if "-d" in sys.argv: # Enable this to measure startup speed
+    if 0:
         import cProfile
         cProfile.run('import bpy; bpy.load_scripts()', 'blender.prof')
 





More information about the Bf-blender-cvs mailing list