#!/usr/bin/env python
import string
import sys
from coral.core.transform.pipeScript import *

fd=open("ex1.spy","rt")
try:
    s=fd.read()
finally:
    fd.close()
script=pipeParse(s)
print script
print "EXEC:"
f2=open("tmp/ex1-output.py","w")
try:
    f2.write(script)
finally:
    f2.close()
exec(script)

pipeScript.getCG().setOutputTo("tmp/test1.txt")
exec(script)
pipeScript.getCG().setOutputTo(sys.stdout)
exec(script)
pipeScript.getCG().setOutputTo("tmp/test2.txt")
exec(script)

fd=open("indent.spy","rt")
try:
    s=fd.read()
finally:
    fd.close()
script=pipeParse(s)
print script
print "EXEC:"
pipeScript.getCG().setOutputTo("tmp/indent.txt")
exec(script)
