mirror of
https://xff.cz/git/u-boot/
synced 2025-09-30 15:01:27 +02:00
tools: patman: fix deprecated Python ConfigParser methods
The method `ConfigParser.readfp()` is marked deprecated[1]. In Python 3.12 this method have been removed, so replace it with `ConfigParser.read_file()`. [1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp Signed-off-by: Brandon Maier <brandon.maier@collins.com> CC: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Simon Glass
parent
698b60a6a2
commit
a148875093
@@ -59,25 +59,25 @@ class _ProjectConfigParser(ConfigParser.ConfigParser):
|
|||||||
|
|
||||||
# Check to make sure that bogus project gets general alias.
|
# Check to make sure that bogus project gets general alias.
|
||||||
>>> config = _ProjectConfigParser("zzz")
|
>>> config = _ProjectConfigParser("zzz")
|
||||||
>>> config.readfp(StringIO(sample_config))
|
>>> config.read_file(StringIO(sample_config))
|
||||||
>>> str(config.get("alias", "enemies"))
|
>>> str(config.get("alias", "enemies"))
|
||||||
'Evil <evil@example.com>'
|
'Evil <evil@example.com>'
|
||||||
|
|
||||||
# Check to make sure that alias gets overridden by project.
|
# Check to make sure that alias gets overridden by project.
|
||||||
>>> config = _ProjectConfigParser("sm")
|
>>> config = _ProjectConfigParser("sm")
|
||||||
>>> config.readfp(StringIO(sample_config))
|
>>> config.read_file(StringIO(sample_config))
|
||||||
>>> str(config.get("alias", "enemies"))
|
>>> str(config.get("alias", "enemies"))
|
||||||
'Green G. <ugly@example.com>'
|
'Green G. <ugly@example.com>'
|
||||||
|
|
||||||
# Check to make sure that settings get merged with project.
|
# Check to make sure that settings get merged with project.
|
||||||
>>> config = _ProjectConfigParser("linux")
|
>>> config = _ProjectConfigParser("linux")
|
||||||
>>> config.readfp(StringIO(sample_config))
|
>>> config.read_file(StringIO(sample_config))
|
||||||
>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
|
>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
|
||||||
[('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')]
|
[('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')]
|
||||||
|
|
||||||
# Check to make sure that settings works with unknown project.
|
# Check to make sure that settings works with unknown project.
|
||||||
>>> config = _ProjectConfigParser("unknown")
|
>>> config = _ProjectConfigParser("unknown")
|
||||||
>>> config.readfp(StringIO(sample_config))
|
>>> config.read_file(StringIO(sample_config))
|
||||||
>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
|
>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
|
||||||
[('am_hero', 'True')]
|
[('am_hero', 'True')]
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user