mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-04 07:54:03 +00:00 
			
		
		
		
	[ Stefano Rivera ]
[ Julian Taylor ] lp-shell: use ipython shell if available
This commit is contained in:
		
						commit
						7acdaaf977
					
				
							
								
								
									
										6
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@ -1,8 +1,12 @@
 | 
				
			|||||||
ubuntu-dev-tools (0.128) UNRELEASED; urgency=low
 | 
					ubuntu-dev-tools (0.128) UNRELEASED; urgency=low
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [ Stefano Rivera ]
 | 
				
			||||||
  * ubuntutools.builder: Detect missing builder and fail early.
 | 
					  * ubuntutools.builder: Detect missing builder and fail early.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 -- Stefano Rivera <stefanor@debian.org>  Mon, 25 Jul 2011 19:36:41 +0200
 | 
					  [ Julian Taylor ]
 | 
				
			||||||
 | 
					  * lp-shell: use ipython shell if available
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 -- Julian Taylor <jtaylor.debian@googlemail.com>  Sun, 14 Aug 2011 18:56:52 +0200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ubuntu-dev-tools (0.127) unstable; urgency=low
 | 
					ubuntu-dev-tools (0.127) unstable; urgency=low
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@ -57,7 +57,7 @@ Recommends: bzr,
 | 
				
			|||||||
            python-gnupginterface,
 | 
					            python-gnupginterface,
 | 
				
			||||||
            python-soappy,
 | 
					            python-soappy,
 | 
				
			||||||
            reportbug (>= 3.39ubuntu1)
 | 
					            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
 | 
					Description: useful tools for Ubuntu developers
 | 
				
			||||||
 This is a collection of useful tools that Ubuntu developers use to make their
 | 
					 This is a collection of useful tools that Ubuntu developers use to make their
 | 
				
			||||||
 packaging work a lot easier.
 | 
					 packaging work a lot easier.
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,8 @@ lp\-shell \- Open an interactive launchpadlib shell.
 | 
				
			|||||||
.SH SYNOPSIS
 | 
					.SH SYNOPSIS
 | 
				
			||||||
.B lp\-shell
 | 
					.B lp\-shell
 | 
				
			||||||
.RB [ \-a ]
 | 
					.RB [ \-a ]
 | 
				
			||||||
 | 
					.RB [ \-\-python ]
 | 
				
			||||||
 | 
					.RB [ \-\-ipython ]
 | 
				
			||||||
.RI [ service ]
 | 
					.RI [ service ]
 | 
				
			||||||
.RI [ "LP API version" ]
 | 
					.RI [ "LP API version" ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -34,6 +36,14 @@ the third argument. Current supported are: "beta", "1.0" and "devel".
 | 
				
			|||||||
.B \-a
 | 
					.B \-a
 | 
				
			||||||
Login anonymously into Launchpad.
 | 
					Login anonymously into Launchpad.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.TP
 | 
				
			||||||
 | 
					.B \-\-ipython
 | 
				
			||||||
 | 
					Use an ipython shell if available (default).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.TP
 | 
				
			||||||
 | 
					.B \-\-python
 | 
				
			||||||
 | 
					Use a regular python shell.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.SH AUTHORS
 | 
					.SH AUTHORS
 | 
				
			||||||
.B lp\-shell
 | 
					.B lp\-shell
 | 
				
			||||||
was written by Martin Pitt <martin.pitt@ubuntu.com>.
 | 
					was written by Martin Pitt <martin.pitt@ubuntu.com>.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										26
									
								
								lp-shell
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								lp-shell
									
									
									
									
									
								
							@ -33,6 +33,13 @@ def main():
 | 
				
			|||||||
    opt_parser.add_option('-a', action='store_true',
 | 
					    opt_parser.add_option('-a', action='store_true',
 | 
				
			||||||
                          dest='anonymous', default=False,
 | 
					                          dest='anonymous', default=False,
 | 
				
			||||||
                          help='Login anonymously into LP.')
 | 
					                          help='Login anonymously into LP.')
 | 
				
			||||||
 | 
					    opt_parser.add_option('--ipython',action='store_const',
 | 
				
			||||||
 | 
					                          dest='shell',const='ipython', default="ipython",
 | 
				
			||||||
 | 
					                          help='Use ipython shell (default).')
 | 
				
			||||||
 | 
					    opt_parser.add_option('--python',action='store_const',
 | 
				
			||||||
 | 
					                          dest='shell',const='python',
 | 
				
			||||||
 | 
					                          help='Use python shell.')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    (options, args) = opt_parser.parse_args()
 | 
					    (options, args) = opt_parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -63,6 +70,25 @@ def main():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    banner += '\nNote: LP can be accessed through the "lp" object.'
 | 
					    banner += '\nNote: LP can be accessed through the "lp" object.'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sh = None
 | 
				
			||||||
 | 
					    if options.shell == "ipython":
 | 
				
			||||||
 | 
					        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
 | 
				
			||||||
 | 
					                # pylint does not handle nested try-except, disable import error
 | 
				
			||||||
 | 
					                # pylint: disable-msg=E0611
 | 
				
			||||||
 | 
					                from IPython.Shell import IPShellEmbed
 | 
				
			||||||
 | 
					                sh = IPShellEmbed(argv=[], user_ns={'lp': launchpad})
 | 
				
			||||||
 | 
					                sh.set_banner(sh.IP.BANNER + '\n' + banner)
 | 
				
			||||||
 | 
					            sh.excepthook = sys.__excepthook__
 | 
				
			||||||
 | 
					        except ImportError:
 | 
				
			||||||
 | 
					            print "E: ipython not available. Using normal python shell."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if sh:
 | 
				
			||||||
 | 
					        sh()
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
        class CompleterConsole(code.InteractiveConsole):
 | 
					        class CompleterConsole(code.InteractiveConsole):
 | 
				
			||||||
            def __init__(self):
 | 
					            def __init__(self):
 | 
				
			||||||
                local = {'lp': launchpad}
 | 
					                local = {'lp': launchpad}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user