Skip to content

Commit 5af5c2a

Browse files
committed
🔨 Improve config.ini parser
1 parent fe62c80 commit 5af5c2a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

buildroot/share/PlatformIO/scripts/configuration.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,23 @@ def apply_config_ini(cp):
180180
# For a key ending in .ini load and parse another .ini file
181181
if ckey.endswith('.ini'):
182182
sect = 'base'
183-
if '@' in ckey: sect, ckey = ckey.split('@')
184-
other_ini = configparser.ConfigParser()
185-
other_ini.read(config_path(ckey))
186-
apply_sections(other_ini, sect)
183+
if '@' in ckey: sect, ckey = map(str.strip, ckey.split('@'))
184+
cp2 = configparser.ConfigParser()
185+
cp2.read(config_path(ckey))
186+
apply_sections(cp2, sect)
187+
ckey = 'base';
187188

188189
# (Allow 'example/' as a shortcut for 'examples/')
189190
elif ckey.startswith('example/'):
190191
ckey = 'examples' + ckey[7:]
191192

192193
# For 'examples/<path>' fetch an example set from GitHub.
193194
# For https?:// do a direct fetch of the URL.
194-
elif ckey.startswith('examples/') or ckey.startswith('http'):
195+
if ckey.startswith('examples/') or ckey.startswith('http:'):
195196
fetch_example(ckey)
196197
ckey = 'base'
197198

198-
elif ckey == 'all':
199+
if ckey == 'all':
199200
apply_sections(cp)
200201

201202
else:

0 commit comments

Comments
 (0)