Verison 1.0.3 Release
Based on Buildbotics 0.4.14
This commit is contained in:
37
scripts/check-config-vars.py
Normal file
37
scripts/check-config-vars.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
'''Check that the configuration variable template used on the RPi matches the
|
||||
variables used in the AVR'''
|
||||
|
||||
import sys
|
||||
import json
|
||||
|
||||
templ = json.load(open('src/resources/config-template.json', 'r'))
|
||||
vars = json.load(open('avr/build/vars.json', 'r'))
|
||||
|
||||
|
||||
def check(section):
|
||||
errors = 0
|
||||
|
||||
for name, entry in section.items():
|
||||
if 'type' in entry:
|
||||
ok = False
|
||||
|
||||
# TODO check that defaults are valid
|
||||
# TODO check that types match
|
||||
|
||||
if 'code' in entry and not entry['code'] in vars:
|
||||
print('"%s" with code "%s" not found' % (name, entry['code']))
|
||||
|
||||
else: ok = True
|
||||
|
||||
if not ok: errors += 1
|
||||
|
||||
else: errors += check(entry)
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
errors = check(templ)
|
||||
print('\n%d errors' % errors)
|
||||
sys.exit(errors != 0)
|
||||
Reference in New Issue
Block a user