Merge pull request #7 from williamspatrick/pprint-settings
Make settings_file.py more git-diff friendly.
diff --git a/settings_file.py b/settings_file.py
index 698d941..fe852ba 100644
--- a/settings_file.py
+++ b/settings_file.py
@@ -1,2 +1,18 @@
#!/usr/bin/python -u
-SETTINGS={'host': {'bootflags': {'default': 'default', 'type': 's', 'name': 'boot_flags'}, 'powerpolicy': {'default': 'RESTORE_LAST_STATE', 'type': 's', 'name': 'power_policy'}, 'restrictedmode': {'default': False, 'type': 'b', 'name': 'restricted_mode'}, 'powercap': {'name': 'power_cap', 'min': 0, 'default': 0, 'max': 1000, 'type': 'i', 'unit': 'watts'}, 'sysstate': {'default': '', 'type': 's', 'name': 'system_state'}}}
\ No newline at end of file
+SETTINGS=\
+{'host': {'bootflags': {'default': 'default',
+ 'name': 'boot_flags',
+ 'type': 's'},
+ 'powercap': {'default': 0,
+ 'max': 1000,
+ 'min': 0,
+ 'name': 'power_cap',
+ 'type': 'i',
+ 'unit': 'watts'},
+ 'powerpolicy': {'default': 'RESTORE_LAST_STATE',
+ 'name': 'power_policy',
+ 'type': 's'},
+ 'restrictedmode': {'default': False,
+ 'name': 'restricted_mode',
+ 'type': 'b'},
+ 'sysstate': {'default': '', 'name': 'system_state', 'type': 's'}}}
diff --git a/settings_parser.py b/settings_parser.py
index 46bb474..9e74f91 100755
--- a/settings_parser.py
+++ b/settings_parser.py
@@ -5,6 +5,7 @@
# adding dependencies to additional modules like yaml
import yaml
+import pprint
SETTINGS_FILE = 'settings.yaml'
OUTPUT_FILE = 'settings_file.py'
@@ -16,5 +17,5 @@
with open(OUTPUT_FILE, 'w') as f:
f.write(FILE_HEADER)
f.write('\n')
- f.write('SETTINGS=')
- f.write(str(data))
+ f.write('SETTINGS=\\\n')
+ pprint.pprint(data, stream=f)