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 lptools import config
30
from launchpadlib.errors import HTTPError
34
usage = "Usage: %prog <bug> [...]"
35
parser = OptionParser(usage)
36
args = parser.parse_args()[1]
38
parser.error("Need at least one bug number")
40
launchpad = config.get_launchpad("list-bugs")
44
bug = launchpad.bugs[bugnum]
45
print "Bug %s: %s" % (bugnum, bug.title)
46
for task in bug.bug_tasks:
47
print " %s: %s" % (task.bug_target_name, task.status)
48
except HTTPError, error:
49
if error.response.status == 401:
50
print >> sys.stderr, \
51
("E: Don't have enough permissions to access bug %s" %
53
print >> sys.stderr, error.content
55
elif error.response.status == 404:
56
print >> sys.stderr, "E: Bug %s not found" % bugnum
60
if __name__ == '__main__':