diff options
author | Zach White <skullydazed@gmail.com> | 2020-12-19 10:46:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-19 19:46:30 +0100 |
commit | 624cafbfd2199fdf9fb0e834d7e9f1df70221336 (patch) | |
tree | 34d05e2a8937bc509d2ce1e455ab1eed604c1622 | |
parent | 5619b1d3db335750bed394b0d27980d67f4f50c5 (diff) | |
download | qmk_firmware-624cafbfd2199fdf9fb0e834d7e9f1df70221336.tar.gz qmk_firmware-624cafbfd2199fdf9fb0e834d7e9f1df70221336.zip |
Change keyboard json format to bring it inline with the current api (#11231)
-rwxr-xr-x | lib/python/qmk/cli/generate/api.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/info.py | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/generate/api.py b/lib/python/qmk/cli/generate/api.py index 9807a9cd6..66db37cb5 100755 --- a/lib/python/qmk/cli/generate/api.py +++ b/lib/python/qmk/cli/generate/api.py | |||
@@ -36,7 +36,7 @@ def generate_api(cli): | |||
36 | keyboard_readme_src = Path('keyboards') / keyboard_name / 'readme.md' | 36 | keyboard_readme_src = Path('keyboards') / keyboard_name / 'readme.md' |
37 | 37 | ||
38 | keyboard_dir.mkdir(parents=True, exist_ok=True) | 38 | keyboard_dir.mkdir(parents=True, exist_ok=True) |
39 | keyboard_info.write_text(json.dumps(kb_all['keyboards'][keyboard_name])) | 39 | keyboard_info.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': {keyboard_name: kb_all['keyboards'][keyboard_name]}})) |
40 | 40 | ||
41 | if keyboard_readme_src.exists(): | 41 | if keyboard_readme_src.exists(): |
42 | copyfile(keyboard_readme_src, keyboard_readme) | 42 | copyfile(keyboard_readme_src, keyboard_readme) |
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index d73ba8cfb..f476dc666 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py | |||
@@ -230,11 +230,15 @@ def merge_info_jsons(keyboard, info_data): | |||
230 | """ | 230 | """ |
231 | for info_file in find_info_json(keyboard): | 231 | for info_file in find_info_json(keyboard): |
232 | # Load and validate the JSON data | 232 | # Load and validate the JSON data |
233 | with info_file.open('r') as info_fd: | 233 | try: |
234 | new_info_data = json.load(info_fd) | 234 | with info_file.open('r') as info_fd: |
235 | new_info_data = json.load(info_fd) | ||
236 | except Exception as e: | ||
237 | _log_error(info_data, "Invalid JSON in file %s: %s: %s" % (str(info_file), e.__class__.__name__, e)) | ||
238 | continue | ||
235 | 239 | ||
236 | if not isinstance(new_info_data, dict): | 240 | if not isinstance(new_info_data, dict): |
237 | _log_error(info_data, "Invalid file %s, root object should be a dictionary.", str(info_file)) | 241 | _log_error(info_data, "Invalid file %s, root object should be a dictionary." % (str(info_file),)) |
238 | continue | 242 | continue |
239 | 243 | ||
240 | # Copy whitelisted keys into `info_data` | 244 | # Copy whitelisted keys into `info_data` |