python: Specify the JSON separators
authorMathieu Bridon <bochecha@daitauha.fr>
Wed, 27 Jun 2018 10:37:39 +0000 (12:37 +0200)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 5 Jul 2018 11:52:38 +0000 (12:52 +0100)
On Python 2, the default JSON separators are ', ' for items and ': ' for
dicts.

On Python 3, the default is the same when no indent is specified, but if
one is (and we do specify one) then the default items separator becomes
',' (the dict separator remains unchanged).

This change explicitly specifies the Python 3 default, which helps
ensuring that the output is identical, whether it was generated by
Python 2 or 3.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/amd/vulkan/radv_icd.py
src/intel/vulkan/anv_icd.py

index 78ed379..cc86bbf 100644 (file)
@@ -44,4 +44,4 @@ if __name__ == '__main__':
     }
 
     with open(args.out, 'w') as f:
-        json.dump(json_data, f, indent = 4, sort_keys=True)
+        json.dump(json_data, f, indent = 4, sort_keys=True, separators=(',', ': '))
index 31bb068..36c2882 100644 (file)
@@ -44,4 +44,4 @@ if __name__ == '__main__':
     }
 
     with open(args.out, 'w') as f:
-        json.dump(json_data, f, indent = 4, sort_keys=True)
+        json.dump(json_data, f, indent = 4, sort_keys=True, separators=(',', ': '))