2010-01-13 14:32:07 +01:00
|
|
|
#!/usr/bin/python -i
|
|
|
|
|
|
|
|
# open an interactive launchpadlib Python shell. If the first command line
|
|
|
|
# argument is "staging", this will be on staging instead of production.
|
|
|
|
|
|
|
|
# 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 code, os, sys
|
|
|
|
|
2010-03-18 11:03:55 +01:00
|
|
|
from launchpadlib.launchpad import Launchpad
|
|
|
|
from launchpadlib.uris import lookup_service_root
|
2010-01-13 14:32:07 +01:00
|
|
|
|
2010-03-18 11:03:55 +01:00
|
|
|
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"'
|
2010-01-13 14:32:07 +01:00
|
|
|
|
|
|
|
lp = Launchpad.login_with('test', instance)
|
2010-02-24 10:41:55 +00:00
|
|
|
|
|
|
|
# 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__
|