#!/usr/pkg/bin/python import os, sys template = """ PROGRAM John Comeau PROGRAM DESCRIPTION """ try: DIRECTORY, classfile = os.path.abspath(sys.argv[1]).split(os.sep)[-2:] PROGRAM = classfile.split('.')[0] DESCRIPTION = sys.argv[2] if len(DESCRIPTION) == 0: raise Exception, "needs descriptive text" jnlptext = template.replace('PROGRAM', PROGRAM).replace( 'DIRECTORY', DIRECTORY).replace('DESCRIPTION', DESCRIPTION) sys.stdout.write(jnlptext) # doesn't tack on an additional linefeed except Exception, instance: sys.stderr.write("Failed creating JNLP file:\n") raise