mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-29 22:45:51 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
7bc9ff8fe1
@ -20,6 +20,23 @@ TEMPLATE_PATH = DATA_PATH / 'templates/api/'
|
||||
BUILD_API_PATH = Path('.build/api_data/')
|
||||
|
||||
|
||||
def _list_constants(output_folder):
|
||||
"""Produce a map of available constants
|
||||
"""
|
||||
ret = {}
|
||||
for file in (output_folder / 'constants').glob('**/*_[0-9].[0-9].[0-9].json'):
|
||||
name, version = file.stem.rsplit('_', 1)
|
||||
if name not in ret:
|
||||
ret[name] = []
|
||||
ret[name].append(version)
|
||||
|
||||
# Ensure content is sorted
|
||||
for name in ret:
|
||||
ret[name] = sorted(ret[name])
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def _resolve_keycode_specs(output_folder):
|
||||
"""To make it easier for consumers, publish pre-merged spec files
|
||||
"""
|
||||
@ -87,6 +104,7 @@ def generate_api(cli):
|
||||
keyboard_list_file = v1_dir / 'keyboard_list.json' # A simple list of keyboard targets
|
||||
keyboard_aliases_file = v1_dir / 'keyboard_aliases.json' # A list of historical keyboard names and their new name
|
||||
keyboard_metadata_file = v1_dir / 'keyboard_metadata.json' # All the data configurator/via needs for initialization
|
||||
constants_metadata_file = v1_dir / 'constants_metadata.json' # Metadata for available constants
|
||||
usb_file = v1_dir / 'usb.json' # A mapping of USB VID/PID -> keyboard target
|
||||
|
||||
if BUILD_API_PATH.exists():
|
||||
@ -151,6 +169,7 @@ def generate_api(cli):
|
||||
keyboard_list_json = json.dumps({'last_updated': current_datetime(), 'keyboards': keyboard_list}, cls=InfoJSONEncoder)
|
||||
keyboard_aliases_json = json.dumps({'last_updated': current_datetime(), 'keyboard_aliases': keyboard_aliases}, cls=InfoJSONEncoder)
|
||||
keyboard_metadata_json = json.dumps(keyboard_metadata, cls=InfoJSONEncoder)
|
||||
constants_metadata_json = json.dumps({'last_updated': current_datetime(), 'constants': _list_constants(v1_dir)})
|
||||
|
||||
if not cli.args.dry_run:
|
||||
keyboard_all_file.write_text(keyboard_all_json)
|
||||
@ -158,3 +177,4 @@ def generate_api(cli):
|
||||
keyboard_list_file.write_text(keyboard_list_json)
|
||||
keyboard_aliases_file.write_text(keyboard_aliases_json)
|
||||
keyboard_metadata_file.write_text(keyboard_metadata_json)
|
||||
constants_metadata_file.write_text(constants_metadata_json)
|
||||
|
Loading…
Reference in New Issue
Block a user