mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-12 17:31:29 +00:00
Remove lp-shell, too.
This commit is contained in:
parent
1cb0bfd1e7
commit
13a6851a10
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -1,7 +1,7 @@
|
|||||||
ubuntu-dev-tools (0.129) UNRELEASED; urgency=low
|
ubuntu-dev-tools (0.129) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* Remove grab-attachments, lp-project-upload, lp-list-bugs and lp-set-dup,
|
* Remove grab-attachments, lp-project-upload, lp-list-bugs, lp-set-dup
|
||||||
which are now included in lptools.
|
and lp-shell which are now included in lptools.
|
||||||
|
|
||||||
-- Jelmer Vernooij <jelmer@ubuntu.com> Wed, 17 Aug 2011 12:47:59 +0200
|
-- Jelmer Vernooij <jelmer@ubuntu.com> Wed, 17 Aug 2011 12:47:59 +0200
|
||||||
|
|
||||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@ -11,7 +11,6 @@ Files: *
|
|||||||
doc/check-symbols.1
|
doc/check-symbols.1
|
||||||
doc/requestsync.1
|
doc/requestsync.1
|
||||||
doc/ubuntu-iso.1
|
doc/ubuntu-iso.1
|
||||||
lp-shell
|
|
||||||
requestsync
|
requestsync
|
||||||
setup.py
|
setup.py
|
||||||
ubuntu-iso
|
ubuntu-iso
|
||||||
@ -47,7 +46,6 @@ Files: 404main
|
|||||||
doc/404main.1
|
doc/404main.1
|
||||||
doc/dgetlp.1
|
doc/dgetlp.1
|
||||||
doc/import-bug-from-debian.1
|
doc/import-bug-from-debian.1
|
||||||
doc/lp-shell.1
|
|
||||||
doc/pbuilder-dist-simple.1
|
doc/pbuilder-dist-simple.1
|
||||||
doc/pbuilder-dist.1
|
doc/pbuilder-dist.1
|
||||||
doc/reverse-build-depends.1
|
doc/reverse-build-depends.1
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
.TH lp-shell "1" "27 March 2010" "ubuntu-dev-tools"
|
|
||||||
.SH NAME
|
|
||||||
lp\-shell \- Open an interactive launchpadlib shell.
|
|
||||||
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B lp\-shell
|
|
||||||
.RB [ \-a ]
|
|
||||||
.RB [ \-\-python ]
|
|
||||||
.RB [ \-\-ipython ]
|
|
||||||
.RI [ service ]
|
|
||||||
.RI [ "LP API version" ]
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.B lp\-shell
|
|
||||||
opens an interactive Python shell with a launchpadlib.Launchpad object "lp"
|
|
||||||
which is ready for use.
|
|
||||||
|
|
||||||
It authenticates against Launchpad with the consumer name "udt-lp-shell". When
|
|
||||||
using \fBlp\-shell\fR with the \fB\-a\fR option it will use the anonymous login
|
|
||||||
from launchpadlib.Launchpad.
|
|
||||||
|
|
||||||
By default \fBlp\-shell\fR connects to the "\fIproduction\fR" Launchpad service
|
|
||||||
using the "\fI1.0\fR" LP API version.
|
|
||||||
|
|
||||||
If you want to connect to another Launchpad service, call \fBlp\-shell\fR with
|
|
||||||
the service name as the second argument. \fBlp\-shell\fR supports all services
|
|
||||||
known by launchpadlib Python module.
|
|
||||||
Currently known are (list can be incomplete or outdated): "production",
|
|
||||||
"staging", "dogfood".
|
|
||||||
|
|
||||||
A different LP API version can be selected by passing the API version to use as
|
|
||||||
the third argument. Current supported are: "beta", "1.0" and "devel".
|
|
||||||
|
|
||||||
.SH OPTIONS
|
|
||||||
.TP
|
|
||||||
.B \-a
|
|
||||||
Login anonymously into Launchpad.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
.B \-\-ipython
|
|
||||||
Use an ipython shell if available (default).
|
|
||||||
|
|
||||||
.TP
|
|
||||||
.B \-\-python
|
|
||||||
Use a regular python shell.
|
|
||||||
|
|
||||||
.SH AUTHORS
|
|
||||||
.B lp\-shell
|
|
||||||
was written by Martin Pitt <martin.pitt@ubuntu.com>.
|
|
||||||
.PP
|
|
||||||
It is released under the terms of the GNU General Public License, version 2
|
|
||||||
or (at your option) any later version.
|
|
112
lp-shell
112
lp-shell
@ -1,112 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
# Open an interactive launchpadlib Python shell.
|
|
||||||
# It supports all known LP service instances and API versions. The login
|
|
||||||
# can optionally happen anonymously.
|
|
||||||
|
|
||||||
# Author: Martin Pitt <martin.pitt@ubuntu.com>
|
|
||||||
# Copyright: (C) 2010 Canonical Ltd.
|
|
||||||
#
|
|
||||||
# This package is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, at version 2.
|
|
||||||
#
|
|
||||||
# This package is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import code
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
from launchpadlib.launchpad import Launchpad
|
|
||||||
from launchpadlib.uris import lookup_service_root
|
|
||||||
|
|
||||||
def main():
|
|
||||||
instance = 'production'
|
|
||||||
valid_api_versions = ('beta', '1.0', 'devel')
|
|
||||||
api_version = '1.0'
|
|
||||||
|
|
||||||
usage = 'Usage: %prog [-a] [instance] [LP API version]'
|
|
||||||
opt_parser = OptionParser(usage)
|
|
||||||
opt_parser.add_option('-a', action='store_true',
|
|
||||||
dest='anonymous', default=False,
|
|
||||||
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()
|
|
||||||
|
|
||||||
if len(args) >= 1:
|
|
||||||
try:
|
|
||||||
instance = lookup_service_root(args[0])
|
|
||||||
except ValueError, err:
|
|
||||||
print 'E: %s' % (err)
|
|
||||||
print 'I: Falling back to "production".'
|
|
||||||
|
|
||||||
if len(args) >= 2:
|
|
||||||
if args[1] in valid_api_versions:
|
|
||||||
api_version = args[1]
|
|
||||||
else:
|
|
||||||
print 'E: "%s" is not a valid LP API version.' % (args[1])
|
|
||||||
print 'I: Falling back to "1.0".'
|
|
||||||
|
|
||||||
if options.anonymous:
|
|
||||||
launchpad = Launchpad.login_anonymously('udt-lp-shell', instance,
|
|
||||||
version=api_version)
|
|
||||||
banner = ('Connected anonymously to LP service "%s" with API version '
|
|
||||||
'"%s":' % (instance, api_version))
|
|
||||||
else:
|
|
||||||
launchpad = Launchpad.login_with('udt-lp-shell', instance,
|
|
||||||
version=api_version)
|
|
||||||
banner = 'Connected to LP service "%s" with API version "%s":' % \
|
|
||||||
(instance, api_version)
|
|
||||||
|
|
||||||
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):
|
|
||||||
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__
|
|
||||||
|
|
||||||
console = CompleterConsole()
|
|
||||||
console.interact(banner)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
Loading…
x
Reference in New Issue
Block a user