summaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2020-12-19 10:46:30 -0800
committerDrashna Jael're <drashna@live.com>2021-01-12 22:46:09 -0800
commitd8ff5fd505f0caa9fa80f08fb61bc8d44b12de38 (patch)
tree05632a3b9f777761863cb928b19f9a0de933b69c /lib/python
parent336e00731044ad0fb28cae1ce63929b2244798fb (diff)
Change keyboard json format to bring it inline with the current api (#11231)
Diffstat (limited to 'lib/python')
-rwxr-xr-xlib/python/qmk/cli/generate/api.py2
-rw-r--r--lib/python/qmk/info.py10
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 9807a9cd68..66db37cb52 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):
keyboard_readme_src = Path('keyboards') / keyboard_name / 'readme.md'
keyboard_dir.mkdir(parents=True, exist_ok=True)
- keyboard_info.write_text(json.dumps(kb_all['keyboards'][keyboard_name]))
+ keyboard_info.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': {keyboard_name: kb_all['keyboards'][keyboard_name]}}))
if keyboard_readme_src.exists():
copyfile(keyboard_readme_src, keyboard_readme)
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index d73ba8cfb6..f476dc666d 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -230,11 +230,15 @@ def merge_info_jsons(keyboard, info_data):
"""
for info_file in find_info_json(keyboard):
# Load and validate the JSON data
- with info_file.open('r') as info_fd:
- new_info_data = json.load(info_fd)
+ try:
+ with info_file.open('r') as info_fd:
+ new_info_data = json.load(info_fd)
+ except Exception as e:
+ _log_error(info_data, "Invalid JSON in file %s: %s: %s" % (str(info_file), e.__class__.__name__, e))
+ continue
if not isinstance(new_info_data, dict):
- _log_error(info_data, "Invalid file %s, root object should be a dictionary.", str(info_file))
+ _log_error(info_data, "Invalid file %s, root object should be a dictionary." % (str(info_file),))
continue
# Copy whitelisted keys into `info_data`