1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-21 08:45:04 -05:00

announce: Automatically generate the diff URL from the previous and current version.

This commit is contained in:
Emmanuel Gil Peyrot 2016-10-03 22:06:22 +01:00
parent bd7cc7037c
commit ad480a6ef8
2 changed files with 15 additions and 7 deletions

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python
# File: announce.py
# Version: 0.8
# Version: 0.9
# Description: a script for announcing XEPs
# Last Modified: 2006-10-03
# Last Modified: 2016-10-03
# Author: Peter Saint-Andre (stpeter@jabber.org)
# License: public domain
# HowTo: ./announce.py xepnum diffs
# HowTo: ./announce.py xepnum
## LICENSE ##
#
@ -57,10 +57,8 @@ 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'
@ -84,7 +82,8 @@ statusNode = (headerNode.getElementsByTagName("status")[0])
xepstatus = getText(statusNode.childNodes)
typeNode = (headerNode.getElementsByTagName("type")[0])
xeptype = getText(typeNode.childNodes)
revNode = (headerNode.getElementsByTagName("revision")[0])
revNodes = headerNode.getElementsByTagName("revision")
revNode = revNodes[0]
versionNode = (revNode.getElementsByTagName("version")[0])
version = getText(versionNode.childNodes)
dateNode = (revNode.getElementsByTagName("date")[0])
@ -120,6 +119,15 @@ elif (xepstatus == "Obsolete"):
elif (xepstatus == "Deferred"):
xepflag = "defer"
# generate the diffs URL
if len(revNodes) > 1:
prevRevNode = revNodes[1]
prevVersionNode = (prevRevNode.getElementsByTagName("version")[0])
prevVersion = getText(prevVersionNode.childNodes)
diffs = 'http://xmpp.org/extensions/diff/api/xep/' + xepnum + '/diff/' + prevVersion + '/vs/' + version
else:
diffs = 'N/A'
## SEND MAIL:
#
# From: editor@xmpp.org

View File

@ -170,7 +170,7 @@ $ # or "export PATH=/usr/local/virtualenv/gen/bin:$PATH
$ ./archive.sh 0353 0.1
$ hg pull && hg update
$ ./gen.py xep-0353.xml
$ ./announce.py 0353 http://xmpp.org/extensions/diff/api/xep/0353/diff/0.1/vs/0.2
$ ./announce.py 0353
]]></code>
</section2>