19
19
#documentation: https://edge.launchpad.net/+apidoc/#bug_task
22
from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT
23
from launchpadlib.credentials import Credentials
24
24
from re import findall
25
25
from urllib import urlopen
27
from launchpadlib.credentials import Credentials
28
from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT
28
cachedir = os.path.expanduser('~/.cache/launchpadlib/')
29
if not os.path.isdir(cachedir):
31
creddir = os.path.expanduser("~/.cache/lp_credentials")
32
if not os.path.isdir(creddir):
34
os.chmod(creddir, 0700)
36
credfile = open(os.path.join(creddir, 'close_launchpad_bugs.txt'), 'r')
37
credentials = Credentials()
38
credentials.load(credfile)
40
launchpad = Launchpad(credentials, EDGE_SERVICE_ROOT, cachedir)
42
launchpad = Launchpad.get_token_and_login('close_launchpad_bugs', EDGE_SERVICE_ROOT, cachedir)
43
credfile = open(os.path.join(creddir, 'close_launchpad_bugs.txt'), 'w')
44
launchpad.credentials.save(credfile)
32
cachedir = os.path.expanduser('~/.cache/launchpadlib/')
33
if not os.path.isdir(cachedir):
35
creddir = os.path.expanduser("~/.cache/lp_credentials")
36
if not os.path.isdir(creddir):
38
os.chmod(creddir, 0700)
40
credpath = os.path.join(creddir, 'close_launchpad_bugs.txt')
42
credfile = open(credpath, 'r')
43
credentials = Credentials()
44
credentials.load(credfile)
46
launchpad = Launchpad(credentials, EDGE_SERVICE_ROOT, cachedir)
48
launchpad = Launchpad.get_token_and_login('close_launchpad_bugs',
49
EDGE_SERVICE_ROOT, cachedir)
50
credfile = open(credpath, 'w')
51
launchpad.credentials.save(credfile)
58
for task in bug.bug_tasks:
59
if task.bug_target_name == 'gtg' and task.status == 'Fix Committed':
60
task.status = 'Fix Released'
48
63
if len(sys.argv) != 2:
49
64
print 'Usage: %s <release>' % sys.argv[0]
52
67
data = urlopen('https://launchpad.net/gtg/+milestone/%s' % sys.argv[1]).read()
53
68
bugs = findall('<a href="\S+/bugs/(\d+)">', data)
54
69
launchpad = lp_login()
55
71
if not 'gtg' in [e.name for e in launchpad.people[launchpad.me].super_teams]:
56
72
print 'You are not a GTG developer, exiting.'
60
bug = launchpad.bugs[bugno]
61
for task in bug.bug_tasks:
62
if task.bug_target_name == 'gtg' and task.status == 'Fix Committed':
63
task.status = 'Fix Released'
64
#task.milestone_link = 'https://api.edge.launchpad.net/beta/gtg/+milestone/0.2.2'
66
print """Bug %s marked as Fix Released,
67
(https://bugs.edge.launchpad.net/gtg/+bug/%s""" % (bugno, bugno)
77
process_bug(launchpad.bugs[bugno])
78
print "Bug #%s marked as Fix Released: " \
79
"https://bugs.edge.launchpad.net/gtg/+bug/%s" % (bugno, bugno)
70
print 'UNABLE TO PROCESS BUG #%s' % bugno
81
print "UNABLE TO PROCESS BUG #%s" % bugno