<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/env python
# newsletter.py
#
# Copyright (C) 2008 Luca Falavigna
#
# Author: Luca Falavigna &lt;dktrkranz@ubuntu.com&gt;
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from datetime import datetime
from re import split, findall, DOTALL
from urllib2 import Request, urlopen

uploaders = dict()
months = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
start = datetime(2011, 10, 31)	# Works since 22/09/2008 only, for older packages please use revno 7
stop = datetime(2011, 11, 6)	# Works since 22/09/2008 only, for older packages please use revno 7
italianuploaders = ('Paolo Rotolo',
                    'Riccardo Coccioli',
                    'Andrea Colangelo',
                    'Matthew East',
                    'Luca Falavigna',
                    'Devid Filoni',
                    'Devid Antonio Filoni',
                    'Andrea Gasparini',
                    'Alessandro Ghersi',
                    'Paolo Naldini',
                    'Salvatore Palma',
                    'Lorenzo De Liso',
                    'Alessio Treglia',
                    'Leo Iannacone',
		    'Paolo Sammicheli')
distros = ('precise',
	   'oneiric',
           'natty',
           'maverick',
           'lucid')

def get_pkgs(pkg):
    pkglist = findall('\s+\S+\s+(\S+)\s+(\d+)\s+[\d+\:]+\s+(\d+).*Source: (\S+).*Version: (\S+).*Distribution: (\S+).*Changed-By: ([\w\s]+) &lt;', pkg, DOTALL)
    for italianuploader in italianuploaders:
        for pkg in pkglist:
            if pkg[6] == italianuploader:
                now = datetime(int(pkg[2]), months[pkg[0]], int(pkg[1]))
                if now &gt;= start and now &lt;= stop:
                    if not uploaders.has_key(italianuploader):
                        uploaders[pkg[6]] = list()
                    uploaders[pkg[6]].append(' * [https://launchpad.net/ubuntu/%s/+source/%s/%s %s %s], per %s' \
                                             % (pkg[5], pkg[3], pkg[4], pkg[3], pkg[4], pkg[5]))

for distro in distros:
    req = Request('https://lists.ubuntu.com/archives/%s-changes.mbox/%s-changes.mbox' % (distro, distro))
    req.add_header('Referer', 'https://lists.ubuntu.com/')
    data = urlopen(req).read()
    for rawpkg in split('From bounces@', data):
        get_pkgs(rawpkg)
for uploader in uploaders.keys():
    print '\n=== %s ===\n' % uploader
    for pkg in uploaders[uploader]:
        print pkg

</pre></body></html>