]> arthur.barton.de Git - bup.git/commitdiff
web-cmd.py: add a tornado import guard like the one for fuse in fuse-cmd.py.
authorRobert S. Edmonds <edmonds@debian.org>
Sat, 10 Aug 2013 20:01:57 +0000 (16:01 -0400)
committerRob Browning <rlb@defaultvalue.org>
Sat, 17 Aug 2013 18:57:28 +0000 (13:57 -0500)
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 <edmonds@debian.org>
[rlb@defaultvalue.org: edited commit and error message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/web-cmd.py

index 6e368a28c6886d48b00811e7b5ccafb431a6b193..37a423f2adb2ac19ce5fbe536f1359ab5b5a03e7 100755 (executable)
@@ -1,10 +1,14 @@
 #!/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('error: cannot find the python "tornado" module; please install it\n')
+    sys.exit(1)
 
 handle_ctrl_c()