diff piecrust/commands/builtin/info.py @ 879:58ae026b4c31

chef: Optimize startup time.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 15 Jun 2017 22:38:05 -0700
parents 4850f8c21b6e
children 07c23be08029
line wrap: on
line diff
--- a/piecrust/commands/builtin/info.py	Thu Jun 15 22:16:34 2017 -0700
+++ b/piecrust/commands/builtin/info.py	Thu Jun 15 22:38:05 2017 -0700
@@ -1,9 +1,6 @@
 import os.path
 import logging
-import fnmatch
 from piecrust.commands.base import ChefCommand
-from piecrust.configuration import ConfigurationDumper
-from piecrust.sources.fs import FSContentSourceBase
 
 
 logger = logging.getLogger(__name__)
@@ -35,6 +32,9 @@
             nargs='?')
 
     def run(self, ctx):
+        import yaml
+        from piecrust.configuration import ConfigurationDumper
+
         if ctx.args.path:
             show = ctx.app.config.get(ctx.args.path)
         else:
@@ -42,7 +42,6 @@
 
         if show is not None:
             if isinstance(show, (dict, list)):
-                import yaml
                 out = yaml.dump(show, default_flow_style=False,
                                 Dumper=ConfigurationDumper)
                 logger.info(out)
@@ -147,6 +146,9 @@
             action='store_true')
 
     def run(self, ctx):
+        import fnmatch
+        from piecrust.sources.fs import FSContentSourceBase
+
         pattern = ctx.args.pattern
         sources = list(ctx.app.sources)
         if not ctx.args.exact and pattern is not None: