Message ID | 20240604161607.1133032-2-brandon.maier@collins.com |
---|---|
State | Accepted |
Commit | 698b60a6a23a29a556d5a00c5eead63fb3fdd4f3 |
Delegated to: | Simon Glass |
Headers | show |
Series | [1/3] tools: binman: fix deprecated Python unittest methods | expand |
Hi Brandon, 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/buildman/bsettings.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org> Does this still work in earlier Pythons? Regards, Simon
Hi Simon, > -----Original Message----- > From: Simon Glass <sjg@chromium.org> > Sent: Tuesday, June 4, 2024 9:14 PM > To: Maier, Brandon L Collins <Brandon.Maier@collins.com> > Cc: u-boot@lists.denx.de > Subject: [External] Re: [PATCH 2/3] tools: binman: fix deprecated Python > ConfigParser methods > > Hi Brandon, > > 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.read_file > > Signed-off-by: Brandon Maier <brandon.maier@collins.com> > > CC: Simon Glass <sjg@chromium.org> > > --- > > tools/buildman/bsettings.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > Does this still work in earlier Pythons? The Python docs say ConfigParser.read_file() was added in Python 3.2. The tools/buildman/pyproject.toml says `requires-python = ">=3.7"` so I assume this is fine. > > Regards, > Simon
Hi Simon, > -----Original Message----- > From: Simon Glass <sjg@chromium.org> > Sent: Tuesday, June 4, 2024 9:14 PM > To: Maier, Brandon L Collins <Brandon.Maier@collins.com> > Cc: u-boot@lists.denx.de > Subject: [External] Re: [PATCH 2/3] tools: binman: fix deprecated Python > ConfigParser methods > > Hi Brandon, > > 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.read_file > > Signed-off-by: Brandon Maier <brandon.maier@collins.com> > > CC: Simon Glass <sjg@chromium.org> > > --- > > tools/buildman/bsettings.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > Does this still work in earlier Pythons? The Python docs say ConfigParser.read_file() was added in Python 3.2. The tools/buildman/pyproject.toml says `requires-python = ">=3.7"` so I assume this is fine. > > Regards, > Simon Applied to u-boot-dm, thanks!
diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py index e225ac2ca0f..aea724fc559 100644 --- a/tools/buildman/bsettings.py +++ b/tools/buildman/bsettings.py @@ -29,7 +29,7 @@ def setup(fname=''): settings.read(config_fname) def add_file(data): - settings.readfp(io.StringIO(data)) + settings.read_file(io.StringIO(data)) def get_items(section): """Get the items from a section of the config.
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/buildman/bsettings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)