metadata: sort json output

ensures the files don't change arbitrarily
This commit is contained in:
Beat Küng 2022-09-30 12:45:08 +02:00
parent 06a0aedbdb
commit 02035d94aa
5 changed files with 3 additions and 6 deletions

View File

@ -489,7 +489,7 @@ actuators = {
with open(output_file, 'w') as outfile:
indent = 2 if verbose else None
json.dump(actuators, outfile, indent=indent)
json.dump(actuators, outfile, indent=indent, sort_keys=True)
if compress:
save_compressed(output_file)

View File

@ -74,7 +74,7 @@ for metadata_type_tuple in args.type:
component_general['metadataTypes'] = metadata_types
with open(filename, 'w') as outfile:
json.dump(component_general, outfile)
json.dump(component_general, outfile, sort_keys=True)
if compress:
save_compressed(filename)

View File

@ -114,7 +114,7 @@ class JsonOutput():
#Json string output.
self.output = json.dumps(all_json,indent=2)
self.output = json.dumps(all_json, indent=2, sort_keys=True)
def Save(self, filename):

View File

@ -4,7 +4,6 @@ Param source code generation script.
"""
from __future__ import print_function
import xml.etree.ElementTree as ET
import codecs
import argparse
import sys

View File

@ -50,9 +50,7 @@ import argparse
from px4params import srcscanner, srcparser, injectxmlparams, xmlout, markdownout, jsonout
import lzma #to create .xz file
import re
import json
import codecs
def save_compressed(filename):
#create lzma compressed version