diff options
| author | Zach White <skullydazed@gmail.com> | 2021-08-20 08:22:41 -0700 |
|---|---|---|
| committer | Zach White <skullydazed@gmail.com> | 2021-08-20 08:22:41 -0700 |
| commit | 1ec6ce8c370d53292979718cc406b66c4c5616a8 (patch) | |
| tree | 05a61c562c26f859f5af6931e50f7181c8fc645c /lib | |
| parent | 92fa07336cd7fcd578c31a8069cf955a4d601327 (diff) | |
| parent | c1add5d0e278da55128964dc305b833fb0bbc063 (diff) | |
| download | qmk_firmware-1ec6ce8c370d53292979718cc406b66c4c5616a8.tar.gz qmk_firmware-1ec6ce8c370d53292979718cc406b66c4c5616a8.zip | |
Merge remote-tracking branch 'origin/master' into develop
Resolved Conflicts:
lib/python/qmk/info.py
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/python/qmk/info.py | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index b6f2ecf64..7f3aabdc3 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py | |||
| @@ -551,39 +551,6 @@ def _check_matrix(info_data): | |||
| 551 | _log_error(info_data, f'MATRIX_ROWS is inconsistent with the size of MATRIX_ROW_PINS: {row_count} != {actual_row_count}') | 551 | _log_error(info_data, f'MATRIX_ROWS is inconsistent with the size of MATRIX_ROW_PINS: {row_count} != {actual_row_count}') |
| 552 | 552 | ||
| 553 | 553 | ||
| 554 | def _merge_layouts(info_data, new_info_data): | ||
| 555 | """Merge new_info_data into info_data in an intelligent way. | ||
| 556 | """ | ||
| 557 | for layout_name, layout_json in new_info_data['layouts'].items(): | ||
| 558 | if layout_name in info_data['layouts']: | ||
| 559 | # Pull in layouts we have a macro for | ||
| 560 | if len(info_data['layouts'][layout_name]['layout']) != len(layout_json['layout']): | ||
| 561 | msg = '%s: %s: Number of elements in info.json does not match! info.json:%s != %s:%s' | ||
| 562 | _log_error(info_data, msg % (info_data['keyboard_folder'], layout_name, len(layout_json['layout']), layout_name, len(info_data['layouts'][layout_name]['layout']))) | ||
| 563 | else: | ||
| 564 | for i, key in enumerate(info_data['layouts'][layout_name]['layout']): | ||
| 565 | key.update(layout_json['layout'][i]) | ||
| 566 | else: | ||
| 567 | # Pull in layouts that have matrix data | ||
| 568 | missing_matrix = False | ||
| 569 | for key in layout_json.get('layout', {}): | ||
| 570 | if 'matrix' not in key: | ||
| 571 | missing_matrix = True | ||
| 572 | |||
| 573 | if not missing_matrix: | ||
| 574 | if layout_name in info_data['layouts']: | ||
| 575 | # Update an existing layout with new data | ||
| 576 | for i, key in enumerate(info_data['layouts'][layout_name]['layout']): | ||
| 577 | key.update(layout_json['layout'][i]) | ||
| 578 | |||
| 579 | else: | ||
| 580 | # Copy in the new layout wholesale | ||
| 581 | layout_json['c_macro'] = False | ||
| 582 | info_data['layouts'][layout_name] = layout_json | ||
| 583 | |||
| 584 | return info_data | ||
| 585 | |||
| 586 | |||
| 587 | def _search_keyboard_h(keyboard): | 554 | def _search_keyboard_h(keyboard): |
| 588 | keyboard = Path(keyboard) | 555 | keyboard = Path(keyboard) |
| 589 | current_path = Path('keyboards/') | 556 | current_path = Path('keyboards/') |
| @@ -723,8 +690,12 @@ def merge_info_jsons(keyboard, info_data): | |||
| 723 | layout_name = info_data['layout_aliases'][layout_name] | 690 | layout_name = info_data['layout_aliases'][layout_name] |
| 724 | 691 | ||
| 725 | if layout_name in info_data['layouts']: | 692 | if layout_name in info_data['layouts']: |
| 726 | for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']): | 693 | if len(info_data['layouts'][layout_name]['layout']) != len(layout['layout']): |
| 727 | existing_key.update(new_key) | 694 | msg = '%s: %s: Number of elements in info.json does not match! info.json:%s != %s:%s' |
| 695 | _log_error(info_data, msg % (info_data['keyboard_folder'], layout_name, len(layout['layout']), layout_name, len(info_data['layouts'][layout_name]['layout']))) | ||
| 696 | else: | ||
| 697 | for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']): | ||
| 698 | existing_key.update(new_key) | ||
| 728 | else: | 699 | else: |
| 729 | layout['c_macro'] = False | 700 | layout['c_macro'] = False |
| 730 | info_data['layouts'][layout_name] = layout | 701 | info_data['layouts'][layout_name] = layout |
