lp-shell: Support all to the launchpadlib Python module known service names.

This commit is contained in:
Michael Bienia 2010-03-18 11:03:55 +01:00
parent dcb7ccbaec
commit c921eaf947
3 changed files with 24 additions and 10 deletions

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
ubuntu-dev-tools (0.97) UNRELEASED; urgency=low
[ Michael Bienia ]
* lp-shell: Support all to the launchpadlib Python module known service
names.
-- Michael Bienia <geser@ubuntu.com> Thu, 18 Mar 2010 11:01:21 +0100
ubuntu-dev-tools (0.96) lucid; urgency=low ubuntu-dev-tools (0.96) lucid; urgency=low
[ Michael Bienia ] [ Michael Bienia ]

View File

@ -4,7 +4,7 @@ lp\-shell \- Open an interactive launchpadlib shell.
.SH SYNOPSIS .SH SYNOPSIS
.B lp\-shell .B lp\-shell
[ staging ] [service]
.SH DESCRIPTION .SH DESCRIPTION
.B lp\-shell .B lp\-shell
@ -13,11 +13,13 @@ which is ready for use.
It authenticates against Launchpad with the consumer name "test". It authenticates against Launchpad with the consumer name "test".
If you want to connect to staging instead of production, call It uses by default the "edge" Launchpad service and the default API version.
If you want to connect to an other Launchpad service, call
.B lp\-shell .B lp\-shell
with the with the service name as the second argument. lp-shell supports all services
.B staging known by launchpadlib Python module.
argument. Currently known are (list can be incomplete or outdated): "production", "edge",
"staging", "dogfood".
.SH AUTHORS .SH AUTHORS
.B lp\-shell .B lp\-shell

View File

@ -17,12 +17,16 @@
import code, os, sys import code, os, sys
from launchpadlib.launchpad import Launchpad, STAGING_SERVICE_ROOT, EDGE_SERVICE_ROOT from launchpadlib.launchpad import Launchpad
from launchpadlib.uris import lookup_service_root
if len(sys.argv) == 2 and sys.argv[1] == 'staging': instance = 'edge'
instance = STAGING_SERVICE_ROOT if len(sys.argv) >= 2:
else: try:
instance = EDGE_SERVICE_ROOT instance = lookup_service_root(sys.argv[1])
except ValueError, err:
print 'E: %s' % (err)
print 'W: Falling back to "edge"'
lp = Launchpad.login_with('test', instance) lp = Launchpad.login_with('test', instance)