1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#!/usr/bin/env python2.7
import os
import sys
import re
import launchpadlib
from launchpadlib.launchpad import Launchpad
projects = {
'linaro-graphics-wg' : '2012.08',
'linaro-kernel' : '12.08',
'linaro-multimedia-wg' : '2012.08',
'linaro-octo-pg' : '2012.08',
'linaro-android' : '12.08',
'linaro-dev-platform' : '12.08',
'linaro-infrastructure' : '2012.08',
'lava' : '2012.08',
'linaro-power' : '2012.08',
'linaro-toolchain' : '4.6-2012.08',
'linaro-toolchain' : '4.7-2012.08'
}
def parse_meta_item(line, filename):
'''Parse a meta information line from a blueprint
'''
line = line.strip()
if not line:
return
try:
(key, value) = line.split(':', 1)
key = key.strip()
value = value.strip()
except ValueError:
#print("\tMeta line '%s' can not be parsed" % line)
return
print("\t\tkey='%s' value='%s'" % (key, value))
if key == "Headline" or key == "Acceptance":
filename.write(" %s ||" % value)
if __name__ == '__main__':
#project_name = sys.argv[1]
#milestone_name = sys.argv[2]
CACHE_DIR = os.path.expanduser('~/.launchpadlib/cache')
launchpad = Launchpad.login_anonymously(
'linaro project management',
'production',
version='devel')
meta_re = re.compile('^Meta.*?:$', re.I)
for team in projects:
project_name = team
milestone_name = projects[team]
filename = './blueprint-%s.moin' % project_name
outfile = open(filename, 'w')
matching_project = launchpad.projects[project_name]
if matching_project is None:
logging.error("No projects matching '%s' found." % project_name)
sys.exit(1)
project_blueprints = matching_project.valid_specifications
for bp in project_blueprints:
milestone = bp.milestone
if milestone is not None and milestone.name == milestone_name:
print "%s\n" % (bp.web_link)
outfile.write("|| [[%s|%s]] || %s ||" % (bp.web_link, bp.title, bp.priority))
in_meta_block = False
for l in bp.whiteboard.splitlines():
if (not in_meta_block):
if meta_re.search(l):
in_meta_block = True
continue
if in_meta_block:
#print("\tmeta line (raw): '%s'" % (l.strip()))
if not l.strip():
in_meta_block = False
continue
parse_meta_item(l, outfile)
print "\n"
outfile.write(" %s ||\n" % bp.implementation_status)
outfile.close()
|