lazily import yaml for faster module load times
authorYang Zhang <y_z@mit.edu>
Wed, 30 Jul 2008 03:39:06 +0000 (23:39 -0400)
committerYang Zhang <y_z@mit.edu>
Wed, 30 Jul 2008 03:39:06 +0000 (23:39 -0400)
svn path=/trunk/packages/sipb-xen-base/; revision=784

files/usr/share/python-support/sipb-xen-base/invirt/config.py

index 02409a4..cd0a9d4 100644 (file)
@@ -1,4 +1,4 @@
-import json, yaml
+import json
 from invirt.common import *
 from os.path import getmtime
 
@@ -36,6 +36,7 @@ def load(src_path = default_src_path,
         # written.
         @with_lock_file('/var/lib/invirt/cache.lock')
         def cfg():
+            import yaml
             cfg = with_closing(file(src_path))(lambda f: yaml.load(f, default_loader))
             try: with_closing(file(cache_path, 'w'))(lambda f: f.write(json.write(cfg)))
             except: pass # silent failure