From b09ecb15e25cc3de7d152f66fe5cf07e3fa39926 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Tue, 11 May 2010 13:21:14 -0400 Subject: [PATCH] bup ftp: work even if the 'readline' module isn't available. Suggested by Joe Beda. --- cmd/ftp-cmd.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/ftp-cmd.py b/cmd/ftp-cmd.py index 52391c6..d40e72a 100755 --- a/cmd/ftp-cmd.py +++ b/cmd/ftp-cmd.py @@ -1,8 +1,15 @@ #!/usr/bin/env python -import sys, os, re, stat, readline, fnmatch +import sys, os, re, stat, fnmatch from bup import options, git, shquote, vfs from bup.helpers import * +try: + import readline +except ImportError: + log('* readline module not available: line editing disabled.\n') + readline = None + + def node_name(text, n): if stat.S_ISDIR(n.mode): return '%s/' % text @@ -89,9 +96,10 @@ pwd = top if extra: lines = extra else: - readline.set_completer_delims(' \t\n\r/') - readline.set_completer(completer) - readline.parse_and_bind("tab: complete") + if readline: + readline.set_completer_delims(' \t\n\r/') + readline.set_completer(completer) + readline.parse_and_bind("tab: complete") lines = inputiter() for line in lines: -- 2.39.2