From 7a5a8b54b4a2c7ce8fa972a70693959835e65db8 Mon Sep 17 00:00:00 2001
From: Pedro Algarvio <pedro@algarvio.me>
Date: Wed, 16 Jan 2013 19:34:15 +0000
Subject: [PATCH] Defer imports to a later stage so Jinja2 does not become a
 build dependency. Fixes #3293.

---
 salt/utils/__init__.py |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py
index 290339d..11f428d 100644
--- a/salt/utils/__init__.py
+++ b/salt/utils/__init__.py
@@ -30,8 +30,6 @@
     HAS_FNCTL = False
 
 # Import salt libs
-import salt.minion
-import salt.payload
 from salt.exceptions import SaltClientError, CommandNotFoundError
 
 
@@ -196,6 +194,12 @@ def daemonize_if(opts, **kwargs):
             data[key[6:]] = val
     if not 'jid' in data:
         return
+
+    # Late import salt libs to overcome circular imports and to allow building
+    # salt without making Jinja2 a build dependency
+    import salt.minion
+    import salt.payload
+
     serial = salt.payload.Serial(opts)
     proc_dir = salt.minion.get_proc_dir(opts['cachedir'])
     fn_ = os.path.join(proc_dir, data['jid'])
-- 
1.7.10

