[Piglit] [PATCH 10/34] gen_texture_query_lod_tests.py: make pyhthon2/3 hybrid
Dylan Baker
baker.dylan.c at gmail.com
Fri Feb 20 18:17:57 PST 2015
One of the things that changed between python2 and 3 is the way
str.translate works. It's a complicated thing to convert, and just doing
the obvious code seems better.
---
generated_tests/gen_texture_query_lod_tests.py | 8 +++++---
.../gen_texture_query_lod_tests/template.glsl_parser_test.mako | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py
index c786a10..40e3471 100644
--- a/generated_tests/gen_texture_query_lod_tests.py
+++ b/generated_tests/gen_texture_query_lod_tests.py
@@ -25,6 +25,8 @@ from __future__ import print_function
import os
import os.path
+import six
+
from templates import template_file
from modules import utils
@@ -82,13 +84,13 @@ REQUIREMENTS = {
def main():
"""Main function."""
- for api, requirement in REQUIREMENTS.iteritems():
+ for api, requirement in six.iteritems(REQUIREMENTS):
lod = 'Lod' if api == 'glsl-4.00' else 'LOD'
dirname = os.path.join("spec", api.lower(), "compiler",
"built-in-functions")
utils.safe_makedirs(dirname)
- for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems():
+ for sampler_type, coord_type in six.iteritems(SAMPLER_TYPE_TO_COORD_TYPE):
requirements = [requirement['extensions']] if requirement['extensions'] else []
# samplerCubeArray types are part GLSL 4.00
@@ -107,7 +109,7 @@ def main():
print(filename)
with open(filename, "w") as f:
- f.write(TEMPLATE.render(
+ f.write(TEMPLATE.render_unicode(
version=requirement['version'],
extensions=requirements,
execution_stage=execution_stage,
diff --git a/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako b/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
index 65155cb..3a95bff 100644
--- a/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
+++ b/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
@@ -11,7 +11,7 @@
* [end config]
*/
-#version ${version.translate(None, '.')}
+#version ${int(float(version) * 100)}
% for extension in extensions:
#extension ${extension} : enable
% endfor
--
2.3.0
More information about the Piglit
mailing list