8 desc
= json
.JSONDecoder().decode('\n'.join(sys
.stdin
.readlines()))
10 # I think it is better to just let it throw an error
11 #if "dev" not in desc or "log" not in desc:
14 for devicename
, dev
in desc
["dev"].items():
15 dev
= desc
["dev"][devicename
]
16 typepath
= os
.path
.join(os
.path
.dirname(__file__
), dev
["type"], "generate.py")
17 # if not os.path.exists(typepath):
18 # print("Cannot find a handler for endpoint type " + dev["type"])
22 ctx
= imp
.load_source("generate", typepath
)
23 deviceconfig
= ctx
.generate(dev
, devicename
)
24 with
open(os
.path
.join(os
.path
.dirname(__file__
), "builds", devicename
+ '.config.json'), 'w') as f
:
25 f
.write(json
.JSONEncoder(indent
=4).encode(deviceconfig
))