diff options
author | Joel Challis <git@zvecr.com> | 2024-01-09 09:59:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 20:59:36 +1100 |
commit | 455cd65e80563469712fe56de15666e06b945636 (patch) | |
tree | bf0627e0c63fa8c2f4c93dd84dafaf01305a0d76 /lib/python/qmk | |
parent | 34aa53324670fd815632b203ecf08010e4cd6f72 (diff) |
Prevent `qmk migrate` processing unparsed info.json values (#22374)
Diffstat (limited to 'lib/python/qmk')
-rw-r--r-- | lib/python/qmk/cli/migrate.py | 5 | ||||
-rw-r--r-- | lib/python/qmk/info.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/migrate.py b/lib/python/qmk/cli/migrate.py index c1b1ad1ea9..0bab5c1949 100644 --- a/lib/python/qmk/cli/migrate.py +++ b/lib/python/qmk/cli/migrate.py @@ -47,9 +47,12 @@ def migrate(cli): files = _candidate_files(cli.args.keyboard) # Filter down keys if requested - keys = info_map.keys() + keys = list(filter(lambda key: info_map[key].get("to_json", True), info_map.keys())) if cli.args.filter: keys = list(set(keys) & set(cli.args.filter)) + rejected = set(cli.args.filter) - set(keys) + for key in rejected: + cli.log.info(f'{{fg_yellow}}Skipping {key} as migration not possible...') cli.log.info(f'{{fg_green}}Migrating keyboard {{fg_cyan}}{cli.args.keyboard}{{fg_green}}.{{fg_reset}}') diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 5500ecdd19..b018ba96fd 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -501,6 +501,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: |