From cc2cc7d08170e4778f1aa76eb38172e1b7dc8978 Mon Sep 17 00:00:00 2001 From: ButchMonkey Date: Mon, 5 Sep 2022 05:48:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20config.ini=20custom=20item?= =?UTF-8?q?s,=20and=20'all'=20(#24720)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/PlatformIO/scripts/configuration.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index 64f73d0dcf..aed9fc2f3d 100644 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -78,8 +78,8 @@ def apply_opt(name, val, conf=None): elif not isdef: break linenum += 1 - lines.insert(linenum, f"{prefix}#define {added} // Added by config.ini\n") - fullpath.write_text('\n'.join(lines), encoding='utf-8') + lines.insert(linenum, f"{prefix}#define {added:30} // Added by config.ini\n") + fullpath.write_text(''.join(lines), encoding='utf-8') # Fetch configuration files from GitHub given the path. # Return True if any files were fetched. @@ -127,7 +127,7 @@ def apply_ini_by_name(cp, sect): iniok = False items = section_items(cp, 'config:base') + section_items(cp, 'config:root') else: - items = cp.items(sect) + items = section_items(cp, sect) for item in items: if iniok or not item[0].startswith('ini_'): @@ -195,8 +195,12 @@ def apply_config_ini(cp): fetch_example(ckey) ckey = 'base' - # Apply keyed sections after external files are done - apply_sections(cp, 'config:' + ckey) + elif ckey == 'all': + apply_sections(cp) + + else: + # Apply keyed sections after external files are done + apply_sections(cp, 'config:' + ckey) if __name__ == "__main__": #