[PATCH phosphor-settingsd 1/2] parser: pprint settings_file.py

OpenBMC Patches openbmc-patches at stwcx.xyz
Sat Apr 2 09:00:53 AEDT 2016


From: Patrick Williams <patrick at stwcx.xyz>

Use pprint for settings map instead of just casting to string.  This
makes the output of the tool better for git-diff because it is sorted
and multiple lines.

Signed-off-by: Patrick Williams <patrick at stwcx.xyz>
---
 settings_parser.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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(SETTINGS_FILE) as s:
 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)
-- 
2.7.1




More information about the openbmc mailing list