comparison makeitso/makeitso.py @ 13:99588f138993

use full dot path to template
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 15 Nov 2010 08:00:00 -0800
parents a6fd93354f23
children edabb0bfe107
comparison
equal deleted inserted replaced
12:a6fd93354f23 13:99588f138993
80 # remove makeitso shebang if it has one 80 # remove makeitso shebang if it has one
81 if shebang_re.match(content): 81 if shebang_re.match(content):
82 content = os.linesep.join(content.splitlines()[1:]) 82 content = os.linesep.join(content.splitlines()[1:])
83 83
84 variables = variables or {} 84 variables = variables or {}
85 template = Template(content) 85 template = tempita.Template(content)
86 missing = missing_variables(template, variables) 86 missing = missing_variables(template, variables)
87 if missing: 87 if missing:
88 # TODO: add a switch for interactive or not 88 # TODO: add a switch for interactive or not
89 variables.update(read_variables(missing)) 89 variables.update(read_variables(missing))
90 print >> fp, template.substitute(**variables) 90 print >> fp, template.substitute(**variables)
121 121
122 # find all variables 122 # find all variables
123 variables = set() 123 variables = set()
124 for arg in args: 124 for arg in args:
125 content = file(arg).read() 125 content = file(arg).read()
126 template = Template(content) 126 template = tempita.Template(content)
127 variables.update(template_variables(template)) 127 variables.update(template_variables(template))
128 128
129 # print them 129 # print them
130 for variable in variables: 130 for variable in variables:
131 print variable 131 print variable