diff options
Diffstat (limited to 'tools/launchpad/get-blueprints.py')
-rwxr-xr-x | tools/launchpad/get-blueprints.py | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/tools/launchpad/get-blueprints.py b/tools/launchpad/get-blueprints.py index 411b771..6aa1389 100755 --- a/tools/launchpad/get-blueprints.py +++ b/tools/launchpad/get-blueprints.py @@ -8,6 +8,25 @@ import re import launchpadlib from launchpadlib.launchpad import Launchpad +def parse_meta_item(line, bp_name): + '''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 __name__ == '__main__': CACHE_DIR = os.path.expanduser('~/.launchpadlib/cache') @@ -16,25 +35,28 @@ if __name__ == '__main__': 'production', version='devel') + meta_re = re.compile('^Meta.*?:$', re.I) + pillar = lp.projects["lava"] project_blueprints = pillar.valid_specifications - for blueprint in project_blueprints: - milestone = blueprint.milestone + for bp in project_blueprints: + milestone = bp.milestone if milestone is not None and milestone.name == '2012.03': - print "%s" % (blueprint) - whiteboard = blueprint.whiteboard -# print "%s" % (whiteboard) - - headlinePattern = re.compile('^Headline: (?P<headline>.*)$', re.IGNORECASE | re.MULTILINE) - headline = headlinePattern.findall(whiteboard) - - acceptancePattern = re.compile('^Acceptance: (?P<acceptance>.*)$', re.IGNORECASE | re.MULTILINE) - acceptance = acceptancePattern.findall(whiteboard) - - for headlineMatch in headline: - print "Headline: %s" % headlineMatch - - for acceptanceMatch in acceptance: - print "Acceptance: %s\n" % acceptanceMatch + print "%s\n" % (bp.web_link) + + 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, bp.name) print "\n" |