diff options
Diffstat (limited to 'lib/python/qmk/info.py')
-rw-r--r-- | lib/python/qmk/info.py | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index d42ba5c660..13588abdb8 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -233,6 +233,9 @@ def _extract_features(info_data, rules): key = '_'.join(key.split('_')[:-1]).lower() value = True if value.lower() in true_values else False if value.lower() in false_values else value + if key in ['lto']: + continue + if 'config_h_features' not in info_data: info_data['config_h_features'] = {} @@ -524,6 +527,9 @@ def _config_to_json(key_type, config_value): """Convert config value using spec """ if key_type.startswith('array'): + if key_type.count('.') > 1: + raise Exception(f"Conversion of {key_type} not possible") + if '.' in key_type: key_type, array_type = key_type.split('.', 1) else: @@ -536,7 +542,7 @@ def _config_to_json(key_type, config_value): else: return list(map(str.strip, config_value.split(','))) - elif key_type == 'bool': + elif key_type in ['bool', 'flag']: if isinstance(config_value, bool): return config_value return config_value in true_values @@ -706,27 +712,23 @@ def _extract_led_config(info_data, keyboard): cols = info_data['matrix_size']['cols'] rows = info_data['matrix_size']['rows'] - # Determine what feature owns g_led_config - features = info_data.get("features", {}) - feature = None - if features.get("rgb_matrix", False): - feature = "rgb_matrix" - elif features.get("led_matrix", False): - feature = "led_matrix" - - if feature: - # Process - for file in find_keyboard_c(keyboard): - try: - ret = find_led_config(file, cols, rows) - if ret: - info_data[feature] = info_data.get(feature, {}) - info_data[feature]["layout"] = ret - except Exception as e: - _log_warning(info_data, f'led_config: {file.name}: {e}') - - if info_data[feature].get("layout", None) and not info_data[feature].get("led_count", None): - info_data[feature]["led_count"] = len(info_data[feature]["layout"]) + for feature in ['rgb_matrix', 'led_matrix']: + if info_data.get('features', {}).get(feature, False) or feature in info_data: + + # Only attempt search if dd led config is missing + if 'layout' not in info_data.get(feature, {}): + # Process + for file in find_keyboard_c(keyboard): + try: + ret = find_led_config(file, cols, rows) + if ret: + info_data[feature] = info_data.get(feature, {}) + info_data[feature]['layout'] = ret + except Exception as e: + _log_warning(info_data, f'led_config: {file.name}: {e}') + + if info_data[feature].get('layout', None) and not info_data[feature].get('led_count', None): + info_data[feature]['led_count'] = len(info_data[feature]['layout']) return info_data |