From: Simon Glass Date: Tue, 14 May 2019 21:53:49 +0000 (-0600) Subject: patman: Support use of stringIO in Python 3 X-Git-Tag: v2019.10-rc1~32^2~60 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ade1e3864f1508ad0ccbce72a39d815c2d7d7c87;p=oweals%2Fu-boot.git patman: Support use of stringIO in Python 3 With Python 3 this class has moved. Update the code to handle both cases. Signed-off-by: Simon Glass --- diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 31481157fc..2c4392dbc1 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -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()]