From: Avery Pennarun Date: Tue, 11 May 2010 17:21:14 +0000 (-0400) Subject: bup ftp: work even if the 'readline' module isn't available. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b09ecb15e25cc3de7d152f66fe5cf07e3fa39926;p=packages%2Fb%2Fbup.git bup ftp: work even if the 'readline' module isn't available. Suggested by Joe Beda. --- 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: