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

chef: Optimize startup time.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 15 Jun 2017 22:38:05 -0700
parents 6db54bed2417
children
line wrap: on
line diff
--- a/piecrust/commands/builtin/util.py	Thu Jun 15 22:16:34 2017 -0700
+++ b/piecrust/commands/builtin/util.py	Thu Jun 15 22:38:05 2017 -0700
@@ -1,9 +1,6 @@
 import os
 import os.path
-import shutil
-import codecs
 import logging
-import yaml
 from piecrust import CACHE_DIR, RESOURCES_DIR
 from piecrust.app import CONFIG_PATH, THEME_CONFIG_PATH
 from piecrust.commands.base import ChefCommand
@@ -21,8 +18,8 @@
 
     def setupParser(self, parser, app):
         parser.add_argument(
-                'destination',
-                help="The destination directory in which to create the website.")
+            'destination',
+            help="The destination directory in which to create the website.")
 
     def run(self, ctx):
         destination = ctx.args.destination
@@ -41,7 +38,8 @@
 
         tpl_path = os.path.join(RESOURCES_DIR, 'webinit', CONFIG_PATH)
         if ctx.args.theme:
-            tpl_path = os.path.join(RESOURCES_DIR, 'webinit', THEME_CONFIG_PATH)
+            tpl_path = os.path.join(RESOURCES_DIR, 'webinit',
+                                    THEME_CONFIG_PATH)
         with open(tpl_path, 'r', encoding='utf-8') as fp:
             config_text = fp.read()
 
@@ -59,6 +57,8 @@
         pass
 
     def run(self, ctx):
+        import shutil
+
         cache_dir = os.path.join(ctx.app.root_dir, CACHE_DIR)
         if cache_dir and os.path.isdir(cache_dir):
             logger.info("Purging cache: %s" % cache_dir)