patman: Support use of stringIO in Python 3
authorSimon Glass <sjg@chromium.org>
Tue, 14 May 2019 21:53:49 +0000 (15:53 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 10 Jul 2019 22:52:58 +0000 (16:52 -0600)
With Python 3 this class has moved. Update the code to handle both cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/patman/func_test.py

index 31481157fc5dcd1d2562ab699129702389ae5774..2c4392dbc103285f15278feeb79926a0bf4ed20b 100644 (file)
@@ -12,15 +12,20 @@ import sys
 import tempfile
 import unittest
 
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
+
 import gitutil
 import patchstream
 import settings
+import tools
 
 
 @contextlib.contextmanager
 def capture():
     import sys
-    from cStringIO import StringIO
     oldout,olderr = sys.stdout, sys.stderr
     try:
         out=[StringIO(), StringIO()]