From 11bd98f684148ed9577b263189121e52027d66d9 Mon Sep 17 00:00:00 2001 From: Zach White Date: Sat, 2 Jan 2021 18:08:17 -0800 Subject: Fix broken keyboards (#11412) * Fix a couple errors * add a dependency for the generated headers --- lib/python/qmk/cli/generate/layouts.py | 19 ++++++++++--------- lib/python/qmk/info.py | 3 +++ 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py index 809f0ef7ec..273870e15c 100755 --- a/lib/python/qmk/cli/generate/layouts.py +++ b/lib/python/qmk/cli/generate/layouts.py @@ -39,15 +39,16 @@ def generate_layouts(cli): # Build the layouts.h file. layouts_h_lines = ['/* This file was generated by `qmk generate-layouts`. Do not edit or copy.' ' */', '', '#pragma once'] - if 'direct' in kb_info_json['matrix_pins']: - col_num = len(kb_info_json['matrix_pins']['direct'][0]) - row_num = len(kb_info_json['matrix_pins']['direct']) - elif 'cols' in kb_info_json['matrix_pins'] and 'rows' in kb_info_json['matrix_pins']: - col_num = len(kb_info_json['matrix_pins']['cols']) - row_num = len(kb_info_json['matrix_pins']['rows']) - else: - cli.log.error('%s: Invalid matrix config.', cli.config.generate_layouts.keyboard) - return False + if 'matrix_pins' in kb_info_json: + if 'direct' in kb_info_json['matrix_pins']: + col_num = len(kb_info_json['matrix_pins']['direct'][0]) + row_num = len(kb_info_json['matrix_pins']['direct']) + elif 'cols' in kb_info_json['matrix_pins'] and 'rows' in kb_info_json['matrix_pins']: + col_num = len(kb_info_json['matrix_pins']['cols']) + row_num = len(kb_info_json['matrix_pins']['rows']) + else: + cli.log.error('%s: Invalid matrix config.', cli.config.generate_layouts.keyboard) + return False for layout_name in kb_info_json['layouts']: if kb_info_json['layouts'][layout_name]['c_macro']: diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index d7b128aa66..2954a17e09 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -134,6 +134,9 @@ def _extract_indicators(info_data, config_c): _log_warning(info_data, f'Indicator {json_key} is specified in both info.json and config.h, the config.h value wins.') if config_key in config_c: + if 'indicators' not in info_data: + info_data['indicators'] = {} + info_data['indicators'][json_key] = config_c.get(config_key) return info_data -- cgit v1.2.3