[Piglit] [PATCH 8/8] framework: update the rest of the piglit-* commands to be py3

Dylan Baker baker.dylan.c at gmail.com
Wed Mar 30 18:18:39 UTC 2016


Convert the rest of the commands using six to make them both python 2
and python 3 safe. This also changes the default chbang to python
instead of python2, which should only be a change on Arch linux.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 piglit-resume.py       | 11 ++++++++---
 piglit-run.py          | 11 ++++++++---
 piglit-summary-html.py | 11 ++++++++---
 piglit-summary.py      | 11 ++++++++---
 4 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/piglit-resume.py b/piglit-resume.py
index c8f0fe2..e2d278e 100755
--- a/piglit-resume.py
+++ b/piglit-resume.py
@@ -1,6 +1,6 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
-# Copyright (c) 2014 Intel Corporation
+# Copyright (c) 2014, 2016 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -31,6 +31,11 @@ from __future__ import (
 )
 import sys
 
+import six
+
 from framework.programs.run import resume
 
-resume([i.decode('utf-8') for i in sys.argv[1:]])
+if six.PY2:
+    resume([i.decode('utf-8') for i in sys.argv[1:]])
+elif six.PY3:
+    resume(sys.argv[1:])
diff --git a/piglit-run.py b/piglit-run.py
index 7f6cf1a..fea67f1 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -1,6 +1,6 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
-# Copyright (c) 2014 Intel Corporation
+# Copyright (c) 2014, 2016 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -31,6 +31,11 @@ from __future__ import (
 )
 import sys
 
+import six
+
 from framework.programs.run import run
 
-run([i.decode('utf-8') for i in sys.argv[1:]])
+if six.PY2:
+    run([i.decode('utf-8') for i in sys.argv[1:]])
+elif six.PY3:
+    run(sys.argv[1:])
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 163d006..1db8a31 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -1,6 +1,6 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
-# Copyright (c) 2014 Intel Corporation
+# Copyright (c) 2014, 2016 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,11 @@ from __future__ import (
 )
 import sys
 
+import six
+
 from framework.programs.summary import html
 
-html([i.decode('utf-8') for i in sys.argv[1:]])
+if six.PY2:
+    html([i.decode('utf-8') for i in sys.argv[1:]])
+elif six.PY3:
+    html(sys.argv[1:])
diff --git a/piglit-summary.py b/piglit-summary.py
index 62f29ce..eb99349 100755
--- a/piglit-summary.py
+++ b/piglit-summary.py
@@ -1,6 +1,6 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
-# Copyright (c) 2014 Intel Corporation
+# Copyright (c) 2014, 2016 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,11 @@ from __future__ import (
 )
 import sys
 
+import six
+
 from framework.programs.summary import console
 
-console([i.decode('utf-8') for i in sys.argv[1:]])
+if six.PY2:
+    console([i.decode('utf-8') for i in sys.argv[1:]])
+elif six.PY3:
+    console(sys.argv[1:])
-- 
2.7.4



More information about the Piglit mailing list