summaryrefslogtreecommitdiff
path: root/tools/patman
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-09-27 16:03:55 +0100
committersjg <sjg@chromium.org>2016-10-09 09:30:32 -0600
commitf5d44b9bae64d4fc347c537e6d5f13d630eb858d (patch)
treec03f1e79a75f32b50edf49b14b6c4677e0eb4348 /tools/patman
parentc9eac38a25b53085f18a831eb28c27512982cc5f (diff)
downloadu-boot-imx-f5d44b9bae64d4fc347c537e6d5f13d630eb858d.zip
u-boot-imx-f5d44b9bae64d4fc347c537e6d5f13d630eb858d.tar.gz
u-boot-imx-f5d44b9bae64d4fc347c537e6d5f13d630eb858d.tar.bz2
patman: Fix doctest StringIO import for python 3.x
In python 3.x StringIO is no longer a module, and the class can instead be found in the io module. Adjust the code in the doctest input to account for both. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman')
-rw-r--r--tools/patman/settings.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 7ef0ab0..5f207f5 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -36,7 +36,10 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- Merge general default settings/aliases with project-specific ones.
# Sample config used for tests below...
- >>> import StringIO
+ >>> try:
+ ... from StringIO import StringIO
+ ... except ImportError:
+ ... from io import StringIO
>>> sample_config = '''
... [alias]
... me: Peter P. <likesspiders@example.com>
@@ -54,25 +57,25 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
# Check to make sure that bogus project gets general alias.
>>> config = _ProjectConfigParser("zzz")
- >>> config.readfp(StringIO.StringIO(sample_config))
+ >>> config.readfp(StringIO(sample_config))
>>> config.get("alias", "enemies")
'Evil <evil@example.com>'
# Check to make sure that alias gets overridden by project.
>>> config = _ProjectConfigParser("sm")
- >>> config.readfp(StringIO.StringIO(sample_config))
+ >>> config.readfp(StringIO(sample_config))
>>> config.get("alias", "enemies")
'Green G. <ugly@example.com>'
# Check to make sure that settings get merged with project.
>>> config = _ProjectConfigParser("linux")
- >>> config.readfp(StringIO.StringIO(sample_config))
+ >>> config.readfp(StringIO(sample_config))
>>> sorted(config.items("settings"))
[('am_hero', 'True'), ('process_tags', 'False')]
# Check to make sure that settings works with unknown project.
>>> config = _ProjectConfigParser("unknown")
- >>> config.readfp(StringIO.StringIO(sample_config))
+ >>> config.readfp(StringIO(sample_config))
>>> sorted(config.items("settings"))
[('am_hero', 'True')]
"""