blob: 9e74f911fd7d1f3c3afad28c6f63cd94f8b50fe1 [file] [log] [blame]
#!/usr/bin/python -u
# Simple parser to create a python dictionary from a yaml file.
# It saves the applications from doing the parsing and
# adding dependencies to additional modules like yaml
import yaml
import pprint
SETTINGS_FILE = 'settings.yaml'
OUTPUT_FILE = 'settings_file.py'
FILE_HEADER = '#!/usr/bin/python -u'
with open(SETTINGS_FILE) as s:
data = yaml.safe_load(s)
with open(OUTPUT_FILE, 'w') as f:
f.write(FILE_HEADER)
f.write('\n')
f.write('SETTINGS=\\\n')
pprint.pprint(data, stream=f)