[PATCH 3/3] nmbug-status: only import notmuch when needed

Subject: [PATCH 3/3] nmbug-status: only import notmuch when needed

Date: Mon, 1 Apr 2013 12:44:02 +0300

To: notmuch@notmuchmail.org

Cc: Tomi Ollila

From: Jani Nikula


Make it possible to use the script to query search views without
notmuch python bindings installed.
---
 devel/nmbug/nmbug-status |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index d83ca2d..775f8ec 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -7,7 +7,6 @@
 #       - argparse; either python 2.7, or install separately
 
 import datetime
-import notmuch
 import rfc822
 import urllib
 import json
@@ -49,6 +48,9 @@ elif args.get_query != None:
         if args.get_query == view['title']:
             print ' and '.join(view['query'])
     sys.exit(0)
+else:
+    # only import notmuch if needed
+    import notmuch
 
 if args.text:
     output_format = 'text'
-- 
1.7.10.4


Thread: