mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 15:41:09 +00:00
62 lines
2.0 KiB
Python
Executable File
62 lines
2.0 KiB
Python
Executable File
#! /usr/bin/python
|
|
# -*- coding: UTF-8 -*-
|
|
"""Briefly list status of Launchpad bugs."""
|
|
|
|
# Copyright (c) 2010 Canonical Ltd.
|
|
#
|
|
# lp-set-dup 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; either version 3, or (at your option) any
|
|
# later version.
|
|
#
|
|
# lp-set-dup 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.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with lp-set-dup; see the file COPYING. If not, write to the Free
|
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
# 02110-1301, USA.
|
|
#
|
|
# Authors:
|
|
# Colin Watson <cjwatson@ubuntu.com>
|
|
|
|
import sys
|
|
|
|
from optparse import OptionParser
|
|
|
|
from ubuntutools.lp.libsupport import get_launchpad
|
|
from launchpadlib.errors import HTTPError
|
|
|
|
if __name__ == '__main__':
|
|
usage = "Usage: %prog <bug> [...]"
|
|
parser = OptionParser(usage)
|
|
options, args = parser.parse_args()
|
|
if len(args) < 1:
|
|
parser.error("Need at least one bug number")
|
|
|
|
try:
|
|
lp = get_launchpad('ubuntu-dev-tools')
|
|
except Exception, e:
|
|
print >>sys.stderr, 'Could not connect to Launchpad:', str(e)
|
|
sys.exit(2)
|
|
|
|
for bugnum in args:
|
|
try:
|
|
bug = lp.bugs[bugnum]
|
|
print "Bug %s: %s" % (bugnum, bug.title)
|
|
for task in bug.bug_tasks:
|
|
print " %s: %s" % (task.bug_target_name, task.status)
|
|
except HTTPError, e:
|
|
if e.response.status == 401:
|
|
print >>sys.stderr, \
|
|
("E: Don't have enough permissions to access bug %s" %
|
|
bugnum)
|
|
print >>sys.stderr, e.content
|
|
continue
|
|
elif e.response.status == 404:
|
|
print >>sys.stderr, "E: Bug %s not found" % bugnum
|
|
else:
|
|
raise
|