Skip to content

Commit

Permalink
Update manifest to use TOML instead of JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafon-ledger committed Nov 25, 2022
1 parent 906dd1f commit c33f392
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions create_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import sys
import argparse
import json
import tomli_w

def auto_int(x):
return int(x, 0)
Expand Down Expand Up @@ -69,27 +69,29 @@ def main():
args = get_argparser().parse_args()
manifest = {}
manifest["name"] = args.appName
manifest["binary"] = args.fileName
if args.targetId:
manifest["targetId"] = hex(args.targetId)
if args.appVersion:
manifest["version"] = args.appVersion
if args.gif:
manifest["icon"] = args.gif
if args.appFlags:
manifest["flags"] = args.appFlags
manifest["derivationPath"] = {}
if args.curve:
manifest["derivationPath"]["curves"] = [args.curve]
if args.path:
manifest["derivationPath"]["paths"] = [args.path]
if args.apiLevel:
manifest["apiLevel"] = args.apiLevel
if args.dataSize :
manifest["dataSize"] = args.dataSize

if args.targetId:
target = hex(args.targetId)
manifest[target] = {}
manifest[target]["binary"] = args.fileName
if args.gif:
manifest[target]["icon"] = args.gif
if args.appFlags:
manifest[target]["flags"] = args.appFlags
manifest[target]["derivationPath"] = {}
if args.curve:
manifest[target]["derivationPath"]["curves"] = args.curve
if args.path:
manifest[target]["derivationPath"]["paths"] = args.path
if args.apiLevel:
manifest[target]["apiLevel"] = args.apiLevel
if args.dataSize:
manifest[target]["dataSize"] = args.dataSize

with open("app.json", 'w') as f:
json.dump(manifest, f, indent=4)
with open("app.toml", 'wb') as f:
tomli_w.dump(manifest, f)

if __name__ == "__main__":
main()
main()

0 comments on commit c33f392

Please sign in to comment.