Skip to content

Commit

Permalink
🔨 Improve config.ini parser
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 11, 2023
1 parent fe62c80 commit 5af5c2a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions buildroot/share/PlatformIO/scripts/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,23 @@ 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/'):
ckey = 'examples' + ckey[7:]

# For 'examples/<path>' 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:
Expand Down

0 comments on commit 5af5c2a

Please sign in to comment.