From d88f4242684d2f802d3de446913f6db070a9178f Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Wed, 6 Jun 2012 17:41:08 +0300 Subject: Get blueprints script v2 --- tools/launchpad/get-blueprints-v2.py | 95 ++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 tools/launchpad/get-blueprints-v2.py diff --git a/tools/launchpad/get-blueprints-v2.py b/tools/launchpad/get-blueprints-v2.py new file mode 100755 index 0000000..75f0bb6 --- /dev/null +++ b/tools/launchpad/get-blueprints-v2.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python2.7 + +import os +import sys +import re + +import launchpadlib +from launchpadlib.launchpad import Launchpad + +projects = { + 'linaro-graphics-wg' : '2012.05', + 'linaro-kernel' : '12.05', + 'linaro-multimedia-wg' : '2012.05', + 'linaro-octo-pg' : '2012.05', + 'linaro-android' : '12.05', + 'linaro-dev-platform' : '12.05', + 'linaro-infrastructure' : '2012.05', + 'lava' : '2012.05', + 'linaro-power' : '2012.05', + 'linaro-toolchain' : '4.6-2012.05', + 'linaro-toolchain' : '4.7-2012.05' +} + +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.rsplit(':', 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() -- cgit v1.2.3