From: Jon Severinsson <[email protected]>

StringIO comes from the 'cStringIO' module in Python 2.x, and from the
'io' module in Python 3.x.

Signed-off-by: Kenneth Graunke <[email protected]>
---
 framework/core.py             | 5 ++++-
 framework/glsl_parser_test.py | 7 ++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 6a3b97a..4d7fcd6 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -34,11 +34,14 @@ import sys
 import time
 import traceback
 from log import log
-from cStringIO import StringIO
 from textwrap import dedent
 from threads import ConcurrentTestPool
 from threads import synchronized_self
 import threading
+try:
+    from cStringIO import StringIO # The Python 2.x import
+except:
+    from io import StringIO # The Python 3.x import
 
 __all__ = [
        'Environment',
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index d0d93bf..9c1d973 100755
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -35,6 +35,12 @@ try:
     import configparser # The Python 3.x name
 except ImportError:
     import ConfigParser as configparser # The Python 2.x name
+
+try:
+    from cStringIO import StringIO # The Python 2.x import
+except:
+    from io import StringIO # The Python 3.x import
+
 import os
 import os.path as path
 import re
@@ -42,7 +48,6 @@ import subprocess
 import sys
 
 from core import Test, testBinDir, TestResult
-from cStringIO import StringIO
 from exectest import PlainExecTest
 
 def add_glsl_parser_test(group, filepath, test_name):
-- 
1.8.2.1

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to