Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
66f19518b4
1 changed files with 11 additions and 12 deletions
|
@ -8,7 +8,6 @@ from milc import cli
|
||||||
|
|
||||||
from qmk.datetime import current_datetime
|
from qmk.datetime import current_datetime
|
||||||
from qmk.info import info_json
|
from qmk.info import info_json
|
||||||
from qmk.json_encoders import InfoJSONEncoder
|
|
||||||
from qmk.json_schema import json_load
|
from qmk.json_schema import json_load
|
||||||
from qmk.keymap import list_keymaps
|
from qmk.keymap import list_keymaps
|
||||||
from qmk.keyboard import find_readme, list_keyboards
|
from qmk.keyboard import find_readme, list_keyboards
|
||||||
|
@ -43,14 +42,14 @@ def _resolve_keycode_specs(output_folder):
|
||||||
overall = load_spec(version)
|
overall = load_spec(version)
|
||||||
|
|
||||||
output_file = output_folder / f'constants/keycodes_{version}.json'
|
output_file = output_folder / f'constants/keycodes_{version}.json'
|
||||||
output_file.write_text(json.dumps(overall), encoding='utf-8')
|
output_file.write_text(json.dumps(overall, separators=(',', ':')), encoding='utf-8')
|
||||||
|
|
||||||
for lang in list_languages():
|
for lang in list_languages():
|
||||||
for version in list_versions(lang):
|
for version in list_versions(lang):
|
||||||
overall = load_spec(version, lang)
|
overall = load_spec(version, lang)
|
||||||
|
|
||||||
output_file = output_folder / f'constants/keycodes_{lang}_{version}.json'
|
output_file = output_folder / f'constants/keycodes_{lang}_{version}.json'
|
||||||
output_file.write_text(json.dumps(overall, indent=4), encoding='utf-8')
|
output_file.write_text(json.dumps(overall, separators=(',', ':')), encoding='utf-8')
|
||||||
|
|
||||||
# Purge files consumed by 'load_spec'
|
# Purge files consumed by 'load_spec'
|
||||||
shutil.rmtree(output_folder / 'constants/keycodes/')
|
shutil.rmtree(output_folder / 'constants/keycodes/')
|
||||||
|
@ -64,7 +63,7 @@ def _filtered_copy(src, dst):
|
||||||
data = json_load(src)
|
data = json_load(src)
|
||||||
|
|
||||||
dst = dst.with_suffix('.json')
|
dst = dst.with_suffix('.json')
|
||||||
dst.write_text(json.dumps(data), encoding='utf-8')
|
dst.write_text(json.dumps(data, separators=(',', ':')), encoding='utf-8')
|
||||||
return dst
|
return dst
|
||||||
|
|
||||||
if dst.suffix == '.jsonschema':
|
if dst.suffix == '.jsonschema':
|
||||||
|
@ -136,7 +135,7 @@ def generate_api(cli):
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard_dir.mkdir(parents=True, exist_ok=True)
|
keyboard_dir.mkdir(parents=True, exist_ok=True)
|
||||||
keyboard_json = json.dumps({'last_updated': current_datetime(), 'keyboards': {keyboard_name: kb_json}})
|
keyboard_json = json.dumps({'last_updated': current_datetime(), 'keyboards': {keyboard_name: kb_json}}, separators=(',', ':'))
|
||||||
if not cli.args.dry_run:
|
if not cli.args.dry_run:
|
||||||
keyboard_info.write_text(keyboard_json, encoding='utf-8')
|
keyboard_info.write_text(keyboard_json, encoding='utf-8')
|
||||||
cli.log.debug('Wrote file %s', keyboard_info)
|
cli.log.debug('Wrote file %s', keyboard_info)
|
||||||
|
@ -150,7 +149,7 @@ def generate_api(cli):
|
||||||
keymap_hjson = kb_json['keymaps'][keymap]['path']
|
keymap_hjson = kb_json['keymaps'][keymap]['path']
|
||||||
keymap_json = v1_dir / keymap_hjson
|
keymap_json = v1_dir / keymap_hjson
|
||||||
keymap_json.parent.mkdir(parents=True, exist_ok=True)
|
keymap_json.parent.mkdir(parents=True, exist_ok=True)
|
||||||
keymap_json.write_text(json.dumps(json_load(Path(keymap_hjson))), encoding='utf-8')
|
keymap_json.write_text(json.dumps(json_load(Path(keymap_hjson)), separators=(',', ':')), encoding='utf-8')
|
||||||
cli.log.debug('Wrote keymap %s', keymap_json)
|
cli.log.debug('Wrote keymap %s', keymap_json)
|
||||||
|
|
||||||
if 'usb' in kb_json:
|
if 'usb' in kb_json:
|
||||||
|
@ -179,12 +178,12 @@ def generate_api(cli):
|
||||||
_resolve_keycode_specs(v1_dir)
|
_resolve_keycode_specs(v1_dir)
|
||||||
|
|
||||||
# Write the global JSON files
|
# Write the global JSON files
|
||||||
keyboard_all_json = json.dumps({'last_updated': current_datetime(), 'keyboards': kb_all}, cls=InfoJSONEncoder)
|
keyboard_all_json = json.dumps({'last_updated': current_datetime(), 'keyboards': kb_all}, separators=(',', ':'))
|
||||||
usb_json = json.dumps({'last_updated': current_datetime(), 'usb': usb_list}, cls=InfoJSONEncoder)
|
usb_json = json.dumps({'last_updated': current_datetime(), 'usb': usb_list}, separators=(',', ':'))
|
||||||
keyboard_list_json = json.dumps({'last_updated': current_datetime(), 'keyboards': keyboard_list}, cls=InfoJSONEncoder)
|
keyboard_list_json = json.dumps({'last_updated': current_datetime(), 'keyboards': keyboard_list}, separators=(',', ':'))
|
||||||
keyboard_aliases_json = json.dumps({'last_updated': current_datetime(), 'keyboard_aliases': keyboard_aliases}, cls=InfoJSONEncoder)
|
keyboard_aliases_json = json.dumps({'last_updated': current_datetime(), 'keyboard_aliases': keyboard_aliases}, separators=(',', ':'))
|
||||||
keyboard_metadata_json = json.dumps(keyboard_metadata, cls=InfoJSONEncoder)
|
keyboard_metadata_json = json.dumps(keyboard_metadata, separators=(',', ':'))
|
||||||
constants_metadata_json = json.dumps({'last_updated': current_datetime(), 'constants': _list_constants(v1_dir)})
|
constants_metadata_json = json.dumps({'last_updated': current_datetime(), 'constants': _list_constants(v1_dir)}, separators=(',', ':'))
|
||||||
|
|
||||||
if not cli.args.dry_run:
|
if not cli.args.dry_run:
|
||||||
keyboard_all_file.write_text(keyboard_all_json, encoding='utf-8')
|
keyboard_all_file.write_text(keyboard_all_json, encoding='utf-8')
|
||||||
|
|
Loading…
Reference in a new issue