#!/usr/local/bin/python import urllib import xml.etree.cElementTree as ET import os import sys ROOT="/x1/mail-archives/mod_mbox" # Get the list of podlings from a list the Incubator PMC maintains. def _get_podlings(): rv = set() u = urllib.urlopen("http://svn.apache.org/repos/asf/incubator/public/trunk/content/podlings.xml") string = u.read() root = ET.fromstring(string) for e in root: if e.get('status') == 'graduated': continue rv.add(e.attrib.get('resource')) rv.update(e.attrib.get('resourceAliases', ',').split(',')) rv.remove('') return rv podlings = _get_podlings() tlps={} count = 0 for files in os.listdir(ROOT): path = files tlp = path[0:path.find('-')] list = path[path.find('-')+1:] # print "%s - %s %s" % (tlp, list, path) if not os.access("%s/%s/listinfo.db" % (ROOT, path), os.F_OK): continue if tlp == "www": tlp = "asf-wide" if tlp in podlings: tlp += '.incubator' if not tlps.has_key(tlp): tlps[tlp] = {} tlps[tlp][list] = [path, 'incubator-'+path][tlp[:-10] in podlings] count = count + 1 keys = tlps.keys() keys.sort() print """ Available Mailing Lists

Welcome to the mail archives on mail-archives.apache.org.

Jump to a specific top-level archive section:
    """ i = 0 colcount = 0 for tlp in keys: if tlp == "asf-wide": print "
  • ASF-wide lists:

    " else: print "
  • %s.apache.org lists:

    " % (tlp, tlp) print "
      " klist = tlps[tlp].keys() klist.sort() for list in klist: print "
    • %s
    • " % (tlps[tlp][list], list) i = i + 1 colcount = colcount + 1 print "
  • " if colcount >= count/3: print """
    """ colcount = 0 print """
"""