Message ID | 20240604161607.1133032-3-brandon.maier@collins.com |
---|---|
State | Accepted |
Commit | a1488750935342f1750bd4f3cbd999688523898e |
Delegated to: | Simon Glass |
Headers | show |
Series | [1/3] tools: binman: fix deprecated Python unittest methods | expand |
On Tue, 4 Jun 2024 at 10:16, Brandon Maier <brandon.maier@collins.com> wrote: > > 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> > --- > tools/patman/settings.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Tue, 4 Jun 2024 at 10:16, Brandon Maier <brandon.maier@collins.com> wrote: > > 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> > --- > tools/patman/settings.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot-dm, thanks!
diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 636983e32da..68c93e313b3 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -59,25 +59,25 @@ class _ProjectConfigParser(ConfigParser.ConfigParser): # Check to make sure that bogus project gets general alias. >>> config = _ProjectConfigParser("zzz") - >>> config.readfp(StringIO(sample_config)) + >>> config.read_file(StringIO(sample_config)) >>> str(config.get("alias", "enemies")) 'Evil <evil@example.com>' # Check to make sure that alias gets overridden by project. >>> config = _ProjectConfigParser("sm") - >>> config.readfp(StringIO(sample_config)) + >>> config.read_file(StringIO(sample_config)) >>> str(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(sample_config)) + >>> config.read_file(StringIO(sample_config)) >>> sorted((str(a), str(b)) for (a, b) in config.items("settings")) [('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')] # Check to make sure that settings works with unknown project. >>> 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")) [('am_hero', 'True')] """
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> --- tools/patman/settings.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)