summaryrefslogtreecommitdiff
path: root/piglit-summary-html.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-03-25 13:37:36 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2016-03-28 09:51:22 -0700
commit6a9d0146407656bcf54b61c44b3d06fa6ddb12d9 (patch)
tree9f478503bcdef0e533c00d601e0e44c72e211a98 /piglit-summary-html.py
parentcc83192b948e056b1c63636e39255030dd1ceee9 (diff)
framework: fix unicode command line arguments with python 2.x
In python 3.x input is unicode by default, but in python 2.x everything is a byte string by default (which assumes ascii encoding), this includes input. Currently when running with python 3.x it's possible to use unicode for input, but python 2.x will choke when it tries to encode the bytes into unicode using the ascii codec. For example, this will work with python 3.x but no with python 2.x: (The character is yuki, Japanese for snow, if memory serves) ./piglit run quick 雪 -c This is actually pretty easy to fix, when running with python 2.x decode each input element into unicode using utf-8 as soon as the input is received. This fixes the above example to work. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Tested-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'piglit-summary-html.py')
-rwxr-xr-xpiglit-summary-html.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 4b5278e77..163d0069a 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -22,7 +22,11 @@
""" Deprecated compatability wrapper for html summary """
+from __future__ import (
+ absolute_import, division, print_function, unicode_literals
+)
import sys
+
from framework.programs.summary import html
-html(sys.argv[1:])
+html([i.decode('utf-8') for i in sys.argv[1:]])