[Piglit] [PATCH 26/45] gen_texture_query_lod_tests.py: use with and print_function

Dylan Baker baker.dylan.c at gmail.com
Wed Nov 12 15:46:08 PST 2014


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 generated_tests/gen_texture_query_lod_tests.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py
index c601a5a..d5dd315 100644
--- a/generated_tests/gen_texture_query_lod_tests.py
+++ b/generated_tests/gen_texture_query_lod_tests.py
@@ -21,6 +21,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
+from __future__ import print_function
 import os
 import os.path
 from textwrap import dedent
@@ -121,7 +122,7 @@ for api, requirement in REQUIREMENTS.iteritems():
                 "spec", api.lower(), "compiler", "built-in-functions",
                 "textureQuery{0}-{1}.{2}".format(Lod, sampler_type,
                                                  file_extension))
-            print filename
+            print(filename)
 
             dirname = os.path.dirname(filename)
             if not os.path.exists(dirname):
@@ -137,11 +138,10 @@ for api, requirement in REQUIREMENTS.iteritems():
                     'usamplerCubeArray', 'samplerCubeArrayShadow']:
                 extensions += ['GL_ARB_texture_cube_map_array']
 
-            f = open(filename, "w")
-            f.write(TEMPLATE.render(version=version,
-                                    extensions=extensions,
-                                    execution_stage=execution_stage,
-                                    sampler_type=sampler_type,
-                                    coord_type=coord_type,
-                                    Lod=Lod))
-            f.close()
+            with open(filename, "w") as f:
+                f.write(TEMPLATE.render(version=version,
+                                        extensions=extensions,
+                                        execution_stage=execution_stage,
+                                        sampler_type=sampler_type,
+                                        coord_type=coord_type,
+                                        Lod=Lod))
-- 
2.1.3



More information about the Piglit mailing list