#!/usr/bin/env python # File: announce.py # Version: 0.8 # Description: a script for announcing XEPs # Last Modified: 2006-10-03 # Author: Peter Saint-Andre (stpeter@jabber.org) # License: public domain # HowTo: ./announce.py xepnum 'diffsurl' # NOTE: the diffsurl MUST be in quotes! # IMPORTS: # import glob import os from select import select import smtplib import socket from string import split,strip,join,find import sys import time from xml.dom.minidom import parse,parseString,Document def getText(nodelist): thisText = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: thisText = thisText + node.data return thisText # get the seconds in the Unix era now = int(time.time()) # READ IN ARGS: # # 1. XEP number # 2. URL for source control diffs xepnum = sys.argv[1]; diffs = sys.argv[2]; xepfile = 'xep-' + xepnum + '.xml' # PARSE XEP HEADERS: # # - title # - abstract # - version # - date # - initials # - remark thexep = parse(xepfile) xepNode = (thexep.getElementsByTagName("xep")[0]) headerNode = (xepNode.getElementsByTagName("header")[0]) titleNode = (headerNode.getElementsByTagName("title")[0]) title = getText(titleNode.childNodes) abstractNode = (headerNode.getElementsByTagName("abstract")[0]) abstract = getText(abstractNode.childNodes) statusNode = (headerNode.getElementsByTagName("status")[0]) xepstatus = getText(statusNode.childNodes) typeNode = (headerNode.getElementsByTagName("type")[0]) xeptype = getText(typeNode.childNodes) revNode = (headerNode.getElementsByTagName("revision")[0]) versionNode = (revNode.getElementsByTagName("version")[0]) version = getText(versionNode.childNodes) dateNode = (revNode.getElementsByTagName("date")[0]) date = getText(dateNode.childNodes) initialsNode = (revNode.getElementsByTagName("initials")[0]) initials = getText(initialsNode.childNodes) remNode = (revNode.getElementsByTagName("remark")[0]) # could be

or