2
"""Lower the importance of fixed bugs that are unreleased."""
3
from __future__ import print_function
8
from optparse import OptionParser
10
from launchpadlib.launchpad import Launchpad
13
FIX_COMMITTED = u'Fix Committed'
16
def get_option_parser():
17
"""Return the option parser for this program."""
18
example = "eg. %prog my-project 0.5.1"
19
usage = "usage: %%prog [options] project <release|NONE> \n%s" % example
20
parser = OptionParser(usage=usage)
22
"-s", "--service", dest="service",
23
help="The service to use.")
25
"-c", "--credentials-file", dest="credentials_file",
26
help="The credentials to use instead of yourself.")
28
"-t", "--tags", dest="tags",
29
help="Match bugs with any of the listed tags.")
31
service='https://api.launchpad.net',
33
credentials_file=None)
37
def lower_fixed_bugtask(bug_task):
38
print('Updating bug %s [%s]' % (
39
bug_task.bug.id, bug_task.bug.title))
40
bug_task.importance = u'High'
45
"""Mark fix committed bugs as released for the users."""
48
parser = get_option_parser()
49
(options, args_) = parser.parse_args(args=argv[1:])
51
# There is not a project and release.
56
lp_args = dict(service_root=options.service, version='devel')
57
if options.credentials_file:
58
credentials_file = os.path.expanduser(options.credentials_file)
59
lp_args['credentials_file'] = credentials_file
60
lp = Launchpad.login_with('close_released_bugs', **lp_args)
61
project = lp.projects[project]
65
milestone = project.getMilestone(name=release)
66
if options.tags is not None:
67
tags = options.tags.split()
72
fixed_bug_tasks = project.searchTasks(
73
status=FIX_COMMITTED, milestone=milestone,
76
fixed_bug_tasks = milestone.searchTasks(status=FIX_COMMITTED)
78
for bug_task in fixed_bug_tasks:
79
lower_fixed_bugtask(bug_task)
83
if __name__ == '__main__':