summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-08-29 22:15:33 -0700
committerEric Anholt <eric@anholt.net>2013-03-22 13:41:46 -0700
commitc0d4d1595db4ba5fa53fe41bb1d673351d88a9a8 (patch)
tree8adfc7d2d6e5e352c84b035b6bb176a052fd11d7
parentc7e8770bd9690bf16560aac06cb10e3327fba5a5 (diff)
run.py: Port to Python 3.
There's just no reason to be using Python 2 anymore. Aside from the usual print() changes, this requires converting the output of subprocess.Popen.communicate() from a byte string to a proper Python str object.
-rwxr-xr-xrun.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/run.py b/run.py
index a667914..c79b2f9 100755
--- a/run.py
+++ b/run.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from getopt import getopt, GetoptError
import re
@@ -12,7 +12,7 @@ Usage: %(progName)s [shader.frag] [shader.vert]
Options:
-h, --help Show this message
"""
- print USAGE % {'progName': sys.argv[0]}
+ print(USAGE % {'progName': sys.argv[0]})
sys.exit(1)
def run_test(filename):
@@ -34,16 +34,16 @@ def run_test(filename):
stderr=subprocess.PIPE,
env=env)
except:
- print filename + " FAIL"
+ print(filename + " FAIL")
return
try:
(stdout, stderr) = p.communicate()
- results = stdout + stderr
+ results = (stdout + stderr).decode("utf-8")
except KeyboardInterrupt:
exit(1)
except:
- print filename + " FAIL "
+ print(filename + " FAIL ")
return
with open(filename + '.out', 'w') as file:
@@ -72,7 +72,7 @@ def run_test(filename):
for t in counts:
if counts[t] != 0:
- print filename + " " + t + ": " + str(counts[t])
+ print(filename + " " + t + ": " + str(counts[t]))
sys.stdout.flush()
def main():