From c921eaf9476baecfc509a177faa082446b4a5274 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Thu, 18 Mar 2010 11:03:55 +0100 Subject: [PATCH] lp-shell: Support all to the launchpadlib Python module known service names. --- debian/changelog | 8 ++++++++ doc/lp-shell.1 | 12 +++++++----- lp-shell | 14 +++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3fed04a..9cb1570 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 18 Mar 2010 11:01:21 +0100 + ubuntu-dev-tools (0.96) lucid; urgency=low [ Michael Bienia ] diff --git a/doc/lp-shell.1 b/doc/lp-shell.1 index 907c350..d2abf72 100644 --- a/doc/lp-shell.1 +++ b/doc/lp-shell.1 @@ -4,7 +4,7 @@ lp\-shell \- Open an interactive launchpadlib shell. .SH SYNOPSIS .B lp\-shell -[ staging ] +[service] .SH DESCRIPTION .B lp\-shell @@ -13,11 +13,13 @@ which is ready for use. 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 -with the -.B staging -argument. +with the service name as the second argument. lp-shell supports all services +known by launchpadlib Python module. +Currently known are (list can be incomplete or outdated): "production", "edge", +"staging", "dogfood". .SH AUTHORS .B lp\-shell diff --git a/lp-shell b/lp-shell index 59c04bb..391e315 100755 --- a/lp-shell +++ b/lp-shell @@ -17,12 +17,16 @@ 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 = STAGING_SERVICE_ROOT -else: - instance = EDGE_SERVICE_ROOT +instance = 'edge' +if len(sys.argv) >= 2: + try: + 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)