[Piglit] [PATCH 11/20] framework: Port from execfile to compile & exec (required by python 3.x)

Jon Severinsson jon at severinsson.net
Fri Apr 12 16:39:53 PDT 2013


---
 framework/core.py |    2 +-
 tests/all.tests   |    6 ++++++
 2 filer ändrade, 7 tillägg(+), 1 borttagning(-)

diff --git a/framework/core.py b/framework/core.py
index 744fda4..62b2ed9 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -608,7 +608,7 @@ def loadTestProfile(filename):
 		'__file__': filename,
 	}
 	try:
-		execfile(filename, ns)
+		exec(compile(open(filename,"rb").read(), filename, 'exec'), ns)
 	except:
 		traceback.print_exc()
 		raise Exception('Could not read tests profile')
diff --git a/tests/all.tests b/tests/all.tests
index 8334c7f..0e2bbaa 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -58,6 +58,12 @@ def power_set(s):
                 result.append(p + [s[-1]])
         return result
 
+try:
+    def execfile(filename):
+        exec(compile(open(filename,"rb").read(), filename, 'exec'))
+except:
+    pass
+
 ######
 # Collecting all tests
 profile = TestProfile()
-- 
1.7.10.4



More information about the Piglit mailing list