"""Iterates over the keyboard/keymap for this command and yields a pairing of each.
"""
forkeyboardin_keyboard_list():
continue_flag=False
ifcli.args.filter:
info_data=dotty(info_json(keyboard))
forfilterincli.args.filter:
if'='infilter:
key,value=filter.split('=',1)
ifvalueintrue_values:
value=True
elifvalueinfalse_values:
value=False
elifvalue.isdigit():
value=int(value)
elif'.'invalueandvalue.replace('.').isdigit():
value=float(value)
ifinfo_data.get(key)!=value:
continue_flag=True
break
ifcontinue_flag:
continue
ifcli.config.compile.keymap=='all':
forkeymapinlist_keymaps(keyboard):
yieldkeyboard,keymap
else:
yieldkeyboard,cli.config.compile.keymap
@cli.argument('filename',nargs='?',arg_only=True,type=qmk.path.FileType('r'),completer=FilesCompleter('.json'),help='The configurator export to compile')
@cli.argument('-kb','--keyboard',type=keyboard_folder,completer=keyboard_completer,help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.')
@cli.argument('-kb','--keyboard',type=is_keyboard_target,completer=keyboard_completer,help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.')
@cli.argument('-km','--keymap',completer=keymap_completer,help='The keymap to build a firmware for. Ignored when a configurator export is supplied.')
@cli.argument('-n','--dry-run',arg_only=True,action='store_true',help="Don't actually build, just show the make command to be run.")
@cli.argument('-j','--parallel',type=int,default=1,help="Set the number of parallel make jobs to run.")
@cli.argument('-f','--filter',arg_only=True,action='append',default=[],help="Filter your list against info.json.")
@cli.argument('-e','--env',arg_only=True,action='append',default=[],help="Set a variable to be passed to make. May be passed multiple times.")
@cli.argument('-c','--clean',arg_only=True,action='store_true',help="Remove object files before compiling.")
@cli.argument('-b','--bootloaders',action='store_true',help='List the available bootloaders.')
@cli.argument('-bl','--bootloader',default='flash',help='The flash command, corresponding to qmk\'s make options of bootloaders.')
@cli.argument('-km','--keymap',help='The keymap to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
@cli.argument('-kb','--keyboard',type=keyboard_folder,completer=keyboard_completer,help='The keyboard to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
@cli.argument('-kb','--keyboard',type=is_keyboard_target,completer=keyboard_completer,help='The keyboard to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
@cli.argument('-n','--dry-run',arg_only=True,action='store_true',help="Don't actually build, just show the make command to be run.")
@cli.argument('-j','--parallel',type=int,default=1,help="Set the number of parallel make jobs to run.")
@cli.argument('-e','--env',arg_only=True,action='append',default=[],help="Set a variable to be passed to make. May be passed multiple times.")
# If we don't find any layouts from info.json or keyboard.h we widen our search. This is error prone which is why we want to encourage people to follow the standard above.
info_data['parse_warnings'].append('%s: Falling back to searching for KEYMAP/LAYOUT macros.'%(keyboard))
forfileinglob('keyboards/%s/*.h'%keyboard):
iffile.endswith('.h'):
these_layouts,these_aliases=find_layouts(file)
ifthese_layouts:
layouts.update(these_layouts)
foralias,alias_textinthese_aliases.items():
ifalias_textinlayouts:
aliases[alias]=alias_text
returnlayouts,aliases
def_log_error(info_data,message):
"""Send an error message to both JSON and the log.
# If we don't find any layouts from info.json or keyboard.h we widen our search. This is error prone which is why we want to encourage people to follow the standard.
info_data['parse_warnings'].append('%s: Falling back to searching for KEYMAP/LAYOUT macros.'%(keyboard))
forfileinglob('keyboards/%s/*.h'%keyboard):
iffile.endswith('.h'):
these_layouts,these_aliases=find_layouts(file)
ifthese_layouts:
layouts.update(these_layouts)
foralias,alias_textinthese_aliases.items():
ifalias_textinlayouts:
aliases[alias]=alias_text
returnlayouts,aliases
definfo_log_error(info_data,message):
"""Send an error message to both JSON and the log.