diff --git a/debian/control b/debian/control index 2217684..c9225d8 100644 --- a/debian/control +++ b/debian/control @@ -57,7 +57,7 @@ Recommends: bzr, python-gnupginterface, python-soappy, reportbug (>= 3.39ubuntu1) -Suggests: python-simplejson | python (>= 2.7), qemu-user-static +Suggests: ipython, python-simplejson | python (>= 2.7), qemu-user-static Description: useful tools for Ubuntu developers This is a collection of useful tools that Ubuntu developers use to make their packaging work a lot easier. diff --git a/lp-shell b/lp-shell index bd8c61f..009e637 100755 --- a/lp-shell +++ b/lp-shell @@ -63,24 +63,35 @@ def main(): banner += '\nNote: LP can be accessed through the "lp" object.' - class CompleterConsole(code.InteractiveConsole): - def __init__(self): - local = {'lp': launchpad} - code.InteractiveConsole.__init__(self, locals=local) - try: - import readline - except ImportError: - print 'I: readline module not available.' - else: - import rlcompleter - readline.parse_and_bind("tab: complete") + try: + try: # ipython >= 0.11 + from IPython.frontend.terminal.embed import InteractiveShellEmbed + sh = InteractiveShellEmbed(banner2=banner, user_ns={'lp': launchpad}) + except ImportError: # ipython < 0.11 + from IPython.Shell import IPShellEmbed + sh = IPShellEmbed(user_ns={'lp': launchpad}) + sh.set_banner(sh.IP.BANNER + '\n' + banner) + sh.excepthook = sys.__excepthook__ + sh() + except ImportError: + class CompleterConsole(code.InteractiveConsole): + def __init__(self): + local = {'lp': launchpad} + code.InteractiveConsole.__init__(self, locals=local) + try: + import readline + except ImportError: + print 'I: readline module not available.' + else: + import rlcompleter + readline.parse_and_bind("tab: complete") - # Disable default apport hook, as lp-shell is intended for interactive use - # and thus exceptions often bubble up to the top level. - sys.excepthook = sys.__excepthook__ + # Disable default apport hook, as lp-shell is intended for interactive use + # and thus exceptions often bubble up to the top level. + sys.excepthook = sys.__excepthook__ - console = CompleterConsole() - console.interact(banner) + console = CompleterConsole() + console.interact(banner) if __name__ == '__main__': main()