2
# -*- coding: UTF-8 -*-
3
"""Briefly list status of Launchpad bugs."""
5
# Copyright (c) 2010 Canonical Ltd.
7
# lp-set-dup is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by the
9
# Free Software Foundation; either version 3, or (at your option) any
12
# lp-set-dup is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with lp-set-dup; see the file COPYING. If not, write to the Free
19
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23
# Colin Watson <cjwatson@ubuntu.com>
26
from optparse import OptionParser
28
from launchpadlib.launchpad import Launchpad
29
from launchpadlib.errors import HTTPError
32
usage = "Usage: %prog <bug> [...]"
33
parser = OptionParser(usage)
34
args = parser.parse_args()[1]
36
parser.error("Need at least one bug number")
39
launchpad = Launchpad.login_with('ubuntu-dev-tools', 'production')
40
except Exception, error:
41
print >> sys.stderr, 'Could not connect to Launchpad:', str(error)
46
bug = launchpad.bugs[bugnum]
47
print "Bug %s: %s" % (bugnum, bug.title)
48
for task in bug.bug_tasks:
49
print " %s: %s" % (task.bug_target_name, task.status)
50
except HTTPError, error:
51
if error.response.status == 401:
52
print >> sys.stderr, \
53
("E: Don't have enough permissions to access bug %s" %
55
print >> sys.stderr, error.content
57
elif error.response.status == 404:
58
print >> sys.stderr, "E: Bug %s not found" % bugnum
62
if __name__ == '__main__':