#!/usr/bin/python
import jinja2
import yaml
import sys

if (len(sys.argv) != 3):
    print("Usage: ./jinja.py <setup.yaml> <xml file>")
    sys.exit()

with open(sys.argv[1], 'r') as f:
    setup = yaml.load(f)


templateLoader = jinja2.FileSystemLoader( searchpath="." )
templateEnv = jinja2.Environment( loader=templateLoader )

template = templateEnv.get_template(sys.argv[2])

templateVars = setup["TEMPLATE_VARS"]

outputText = template.render( templateVars )

print(outputText)
