#! /usr/bin/python if __name__ == "__main__": import locale ; locale.setlocale(locale.LC_ALL, '') import os, sys import kid kid.enable_import() # Parse the command line arguments if len(sys.argv) < 4: sys.stderr.write("$ tate-make-summary ...\n"); sys.exit(1) # Split the arguments up baseurl = sys.argv[1] outputpath = sys.argv[2] rssfiles = sys.argv[3:] # Work out the file names we'll be dealing with outputrssfile = os.path.join(outputpath, "index.rss") outputhtmlfile = os.path.join(outputpath, "index.html") # Generate the RSS import SummaryRSSGenerator rss = SummaryRSSGenerator.generate_rss(baseurl=baseurl, files=rssfiles) file(outputrssfile, "w").write(str(rss)) # Generate the HTML import summaryrss2html t = summaryrss2html.Template(rssfile=outputrssfile) t.write(file=file(outputhtmlfile, "w"), encoding="ascii", output='xhtml') # Copy the CSS file to the right location # TODO: also pass a site base URL and copy the CSS there, after passing the # same URL to the template so it loads the CSS import shutil shutil.copy("gallery.css", outputpath)