From 2bc20644d1a193120323388798668c932ae02366 Mon Sep 17 00:00:00 2001 From: "Robert S. Edmonds" Date: Sat, 10 Aug 2013 15:59:37 -0400 Subject: [PATCH] cmd/web: add an import guard like the one in cmd/fuse In Debian, we replace the embedded copy of tornado with a Recommends on the python-tornado package. Print a nice error message instead of a backtrace if the user doesn't have it installed. Signed-off-by: Robert S. Edmonds --- cmd/web-cmd.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/web-cmd.py b/cmd/web-cmd.py index 6e368a2..6a08fa3 100755 --- a/cmd/web-cmd.py +++ b/cmd/web-cmd.py @@ -1,10 +1,15 @@ #!/usr/bin/env python import sys, stat, urllib, mimetypes, posixpath, time -import tornado.httpserver -import tornado.ioloop -import tornado.web from bup import options, git, vfs from bup.helpers import * +try: + import tornado.httpserver + import tornado.ioloop + import tornado.web +except ImportError: + log('bup: error: The python "tornado" module is missing.\n' + + 'Please install it in order to use bup web.\n') + sys.exit(1) handle_ctrl_c() -- 2.39.5