1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-25 02:32:18 -05:00

Adding buildAll functionality.

git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@3508 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Tobias Markmann 2009-10-08 13:55:32 +00:00
parent 149aa9f2f4
commit e117c97afe

33
gen.py
View File

@ -38,6 +38,7 @@ import os
import re import re
import sys import sys
import getopt import getopt
import glob
XEPPATH = "/var/www/vhosts/xmpp.org/extensions" XEPPATH = "/var/www/vhosts/xmpp.org/extensions"
BUILDDICT = "/var/xsf/xepbuild.dict" BUILDDICT = "/var/xsf/xepbuild.dict"
@ -132,14 +133,14 @@ def buildPDF( file ):
os.chdir("/tmp/xepbuilder") os.chdir("/tmp/xepbuilder")
error, desc = commands.getstatusoutput("xelatex -interaction=batchmode xep-" + nr + ".tex") error, desc = commands.getstatusoutput("xelatex -interaction=batchmode xep-" + nr + ".tex")
if not checkError(error, desc): #if not checkError(error, desc):
os.chdir(olddir) # os.chdir(olddir)
return False # return False
error, desc = commands.getstatusoutput("xelatex -interaction=batchmode xep-" + nr + ".tex") error, desc = commands.getstatusoutput("xelatex -interaction=batchmode xep-" + nr + ".tex")
if not checkError(error, desc): #if not checkError(error, desc):
os.chdir(olddir) # os.chdir(olddir)
return False # return False
os.chdir(olddir) os.chdir(olddir)
@ -161,6 +162,11 @@ def buildXEP( filename ):
else: else:
print "PDF(ERROR)" print "PDF(ERROR)"
def buildAll():
files = glob.glob('xep-????.xml')
for file in files:
buildXEP( file )
def usage(): def usage():
print "gen.py: generate nice XHTML and beatuy PDF out of the XEP XML" print "gen.py: generate nice XHTML and beatuy PDF out of the XEP XML"
print "" print ""
@ -172,9 +178,10 @@ def usage():
def main(argv): def main(argv):
global verbose global verbose
buildall = False
try: try:
options, remainder = getopt.gnu_getopt(argv, "v") options, remainder = getopt.gnu_getopt(argv, "va")
except getopt.GetoptError: except getopt.GetoptError:
usage() usage()
sys.exit(2) sys.exit(2)
@ -182,8 +189,11 @@ def main(argv):
for opt, arg in options: for opt, arg in options:
if opt in ('-v'): if opt in ('-v'):
verbose = True verbose = True
elif opt in ('-a'):
xep = remainder[0] buildall = True
if len(remainder) > 0:
xep = remainder[0]
last_build = loadDict(BUILDDICT) last_build = loadDict(BUILDDICT)
@ -192,7 +202,10 @@ def main(argv):
commands.getstatusoutput("cp ../images/xmpp.pdf /tmp/xepbuilder/xmpp.pdf") commands.getstatusoutput("cp ../images/xmpp.pdf /tmp/xepbuilder/xmpp.pdf")
commands.getstatusoutput("cp ../images/xmpp-text.pdf /tmp/xepbuilder/xmpp-text.pdf") commands.getstatusoutput("cp ../images/xmpp-text.pdf /tmp/xepbuilder/xmpp-text.pdf")
buildXEP( xep ) if buildall:
buildAll()
else:
buildXEP( xep )
saveDict(BUILDDICT, last_build) saveDict(BUILDDICT, last_build)