--- /dev/null
+#!/usr/bin/env python
+from launchpadlib.launchpad import Launchpad
+from datetime import datetime, timedelta
+
+# XXX change to suit
+cachedir = '/home/berick/.lpcache'
+
+# report on last 7 days
+end_date = datetime.utcnow()
+start_date = end_date - timedelta(days=7)
+
+launchpad = Launchpad.login_anonymously('testing', service_root="production")
+project = launchpad.projects["evergreen"]
+
+tasks = project.searchTasks(
+ modified_since = start_date.strftime('%F'),
+ order_by = ['milestone', 'title']
+)
+
+new_bugs = []
+committed_bugs = []
+
+for task in tasks:
+ bug = task.bug # avoid re-fetch
+
+ if task.date_fix_committed:
+ if task.date_fix_committed.replace(tzinfo=None) > start_date:
+ committed_bugs.append({'task' : task, 'bug' : bug})
+
+ if bug.date_created.replace(tzinfo=None) > start_date:
+ new_bugs.append({'task' : task, 'bug' : bug})
+
+last_milestone = None
+def print_task(task_chunk):
+ global last_milestone
+ task = task_chunk['task']
+ bug = task_chunk['bug']
+
+ milestone = '<unset>'
+ if task.milestone:
+ milestone = str(task.milestone).split('/')[-1:][0]
+
+ if last_milestone is None or last_milestone != milestone:
+ last_milestone = milestone
+ print 'Milestone: %s' % milestone
+ print '---------\n'
+
+ owner = bug.owner_link.split('~')[-1:][0]
+
+ print '%s' % task.title.replace(' in Evergreen', '')
+ print '\timportance: %s; status: %s; comments: %d\n' % (
+ task.importance, task.status, bug.message_count - 1)
+
+# ----------------------------------------------------------------
+# Print
+# ----------------------------------------------------------------
+
+print "Launchpad Evergreen Digest From %s to %s" % (start_date.strftime('%F'), end_date.strftime('%F'))
+print "Tasks Committed: %d" % len(committed_bugs)
+print "New Bugs: %d" % len(new_bugs)
+print ''
+
+print '------------------------------------------'
+print 'Committed Tasks:'
+print '------------------------------------------'
+print ''
+for task_chunk in committed_bugs: print_task(task_chunk)
+
+last_milestone = None
+
+print '------------------------------------------'
+print 'New Bugs:'
+print '------------------------------------------'
+print ''
+for task_chunk in new_bugs: print_task(task_chunk)
+
+
+