From 5af5c2a35c2bfa6c3128fd69f4c57a5eccc82147 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 11 Jan 2023 01:19:45 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Improve=20config.ini=20parser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/configuration.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index aed9fc2f3d02..d752ebc2c828 100644 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -180,10 +180,11 @@ def apply_config_ini(cp): # For a key ending in .ini load and parse another .ini file if ckey.endswith('.ini'): sect = 'base' - if '@' in ckey: sect, ckey = ckey.split('@') - other_ini = configparser.ConfigParser() - other_ini.read(config_path(ckey)) - apply_sections(other_ini, sect) + if '@' in ckey: sect, ckey = map(str.strip, ckey.split('@')) + cp2 = configparser.ConfigParser() + cp2.read(config_path(ckey)) + apply_sections(cp2, sect) + ckey = 'base'; # (Allow 'example/' as a shortcut for 'examples/') elif ckey.startswith('example/'): @@ -191,11 +192,11 @@ def apply_config_ini(cp): # For 'examples/' fetch an example set from GitHub. # For https?:// do a direct fetch of the URL. - elif ckey.startswith('examples/') or ckey.startswith('http'): + if ckey.startswith('examples/') or ckey.startswith('http:'): fetch_example(ckey) ckey = 'base' - elif ckey == 'all': + if ckey == 'all': apply_sections(cp) else: