diff --git a/package/package_esp8266com_index.template.json b/package/package_esp8266com_index.template.json index fcd05c287..0a85b00e1 100644 --- a/package/package_esp8266com_index.template.json +++ b/package/package_esp8266com_index.template.json @@ -292,4 +292,4 @@ "name": "esp8266" } ] -} +} \ No newline at end of file diff --git a/tools/boards.txt.py b/tools/boards.txt.py index 572fd91e3..c6e10ff56 100755 --- a/tools/boards.txt.py +++ b/tools/boards.txt.py @@ -37,6 +37,7 @@ import sys import collections import getopt import re +import json # serial upload speed order in menu # default is 115 for every board unless specified with 'serial' in board @@ -1416,9 +1417,11 @@ def package (): newfilestr = re.sub(r'"boards":[^\]]*\],', substitution, filestr, re.MULTILINE) + # To get consistent indent/formatting read the JSON and write it out programattically if packagegen: with open(pkgfname, 'w') as package_file: - package_file.write(newfilestr) + filejson = json.loads(filestr, object_pairs_hook=collections.OrderedDict) + package_file.write(json.dumps(filejson, indent=3, separators=(',',': '))) print("updated: %s" % pkgfname) else: sys.stdout.write(newfilestr)