Commit 8ef2aab2 authored by Vinson Lee's avatar Vinson Lee
Browse files

generators: Add positional argument specifiers.



Fix build errors with Python < 2.7.
Signed-off-by: Vinson Lee's avatarVinson Lee <vlee@freedesktop.org>
parent fcd3c281
......@@ -67,7 +67,7 @@ def generate(dirname, type_name, op, usage, shader_target):
print(filename)
with open(filename, 'w') as f:
f.write(TEMPLATES.get_template(
'{}.glsl_parser_test.mako'.format(usage)).render(
'{0}.glsl_parser_test.mako'.format(usage)).render(
type_name=type_name,
mode=mode,
dest=dest,
......
......@@ -100,10 +100,10 @@ def main():
coord=params.coord))
for stage in ['frag', 'vert']:
print('{}.{}'.format(name, stage))
with open('{}.{}'.format(name, stage), 'w+') as f:
print('{0}.{1}'.format(name, stage))
with open('{0}.{1}'.format(name, stage), 'w+') as f:
f.write(TEMPLATES.get_template(
'tex_grad.{}.mako'.format(stage)).render_unicode(
'tex_grad.{0}.mako'.format(stage)).render_unicode(
param=params,
extensions=get_extensions(params.mode)))
......
......@@ -114,9 +114,9 @@ def generate_tests(type_list, base_name, major, minor):
api_type = "ivec{0}".format(type_[-1])
if type_[-1] in ["2", "3", "4"]:
name = 'u{}{}'.format(type_[0], type_[-1])
name = 'u{0}{1}'.format(type_[0], type_[-1])
else:
name = 'u{}'.format(type_[0])
name = 'u{0}'.format(type_[0])
test_vectors.append((type_, name, value))
api_vectors.append((api_type, name, alt_numbers))
......@@ -144,17 +144,17 @@ def generate_array_tests(type_list, base_name, major, minor):
for k in xrange(num_values):
numbers.append(get_value(type_, i + j + k))
yield '{}({})'.format(type_, ', '.join(numbers))
yield '{0}({1})'.format(type_, ', '.join(numbers))
# pylint: enable=undefined-loop-variable
vecs = []
for i, (type_, num_values) in enumerate(type_list):
if type_[-1] in ["2", "3", "4"]:
name = 'u{}{}'.format(type_[0], type_[-1])
name = 'u{0}{1}'.format(type_[0], type_[-1])
else:
name = 'u{}'.format(type_[0])
name = 'u{0}'.format(type_[0])
array_type = '{}[2]'.format(type_)
array_type = '{0}[2]'.format(type_)
value = "{0}({1})".format(array_type, ", ".join(parts()))
vecs.append((array_type, name, value))
......
......@@ -31,7 +31,7 @@ from mako.lookup import TemplateLookup
# Based on a similar setup in framework/summary
MAKO_TEMP_DIR = os.path.join(tempfile.gettempdir(),
'piglit-{}'.format(getpass.getuser()),
'piglit-{0}'.format(getpass.getuser()),
'generators', 'templates')
TEMPLATE_DIR = os.path.abspath(os.path.dirname(__file__))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment