@chapters Make environment initializers @url c:\sample.bat @url c:\sample.sh """ Navigate to @url nodes below and change the properties You can change the heading also to change to have a .sh or .bat/.cmd files. Then, if you run this script (press CTRL-B), then it looks for all @url child nodes and takes the content from the node and writes to the file specified in proper dos batch file or bash shell format. Those files can then be run to set the environment. Caution: This script does not process comment lines within @url child nodes well. Other nodes are ignored. """ import os for child in p.children_iter(): hs = child.headString() (nodetype, nodepath) = hs.split(' ', 2) if nodetype == "@url": (filepath, filename) = os.path.split(nodepath) (shortname, extension) = os.path.splitext(filename) fp = open(nodepath, "w") prefix = "export" if extension in ('.bat', '.cmd'): prefix = "set" g.es("%s => processed" % hs, color="darkgreen") for prop in child.bodyString().split("\n"): line = prop.strip() if line != '': g.es(" %s %s\n" % (prefix, prop), color="darkslategrey") fp.write("%s %s\n" % (prefix, prop)) fp.close() else: g.es("%s => ignored" % hs, color="orange") JAVA_HOME=c:\jdk ANT_HOME=c:\ant JAVA_HOME=c:/jdk ANT_HOME=c:/ant