Fix compiling json files
This commit is contained in:
parent
15e5f57952
commit
033c7af292
@ -37,7 +37,7 @@ def compile(cli):
|
|||||||
cli.log.info('Creating {fg_cyan}%s{style_reset_all} keymap in {fg_cyan}%s', user_keymap['keymap'], keymap_path)
|
cli.log.info('Creating {fg_cyan}%s{style_reset_all} keymap in {fg_cyan}%s', user_keymap['keymap'], keymap_path)
|
||||||
|
|
||||||
# Compile the keymap
|
# Compile the keymap
|
||||||
command = compile_configurator_json(cli.args.filename)
|
command = compile_configurator_json(user_keymap)
|
||||||
|
|
||||||
cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap'])
|
cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap'])
|
||||||
|
|
||||||
|
@ -25,16 +25,14 @@ def create_make_command(keyboard, keymap, target=None):
|
|||||||
return ['make', ':'.join((keyboard, keymap, target))]
|
return ['make', ':'.join((keyboard, keymap, target))]
|
||||||
|
|
||||||
|
|
||||||
def parse_configurator_json(configurator_filename):
|
def parse_configurator_json(configurator_file):
|
||||||
"""Open and parse a configurator json export
|
"""Open and parse a configurator json export
|
||||||
"""
|
"""
|
||||||
file = open(configurator_filename)
|
user_keymap = json.load(configurator_file)
|
||||||
user_keymap = json.load(file)
|
|
||||||
file.close()
|
|
||||||
return user_keymap
|
return user_keymap
|
||||||
|
|
||||||
|
|
||||||
def compile_configurator_json(configurator_filename, bootloader=None):
|
def compile_configurator_json(user_keymap, bootloader=None):
|
||||||
"""Convert a configurator export JSON file into a C file
|
"""Convert a configurator export JSON file into a C file
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -47,9 +45,6 @@ def compile_configurator_json(configurator_filename, bootloader=None):
|
|||||||
Returns:
|
Returns:
|
||||||
A command to run to compile and flash the C file.
|
A command to run to compile and flash the C file.
|
||||||
"""
|
"""
|
||||||
# Parse the configurator json
|
|
||||||
user_keymap = parse_configurator_json(configurator_filename)
|
|
||||||
|
|
||||||
# Write the keymap C file
|
# Write the keymap C file
|
||||||
qmk.keymap.write(user_keymap['keyboard'], user_keymap['keymap'], user_keymap['layout'], user_keymap['layers'])
|
qmk.keymap.write(user_keymap['keyboard'], user_keymap['keymap'], user_keymap['layout'], user_keymap['layers'])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user