Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
		@@ -19,3 +19,5 @@ AUDIO_ENABLE = no           # Audio output
 | 
			
		||||
 | 
			
		||||
# Enable generic behavior for split boards
 | 
			
		||||
SPLIT_KEYBOARD = yes
 | 
			
		||||
 | 
			
		||||
LAYOUTS = ortho_5x5 ortho_5x10
 | 
			
		||||
 
 | 
			
		||||
@@ -16,4 +16,4 @@ NKRO_ENABLE = no            # Enable N-Key Rollover
 | 
			
		||||
BACKLIGHT_ENABLE = no       # Enable keyboard RGB underglow
 | 
			
		||||
AUDIO_ENABLE = no           # Audio output
 | 
			
		||||
 | 
			
		||||
LAYOUTS = ortho_5x15
 | 
			
		||||
LAYOUTS = ortho_5x5 ortho_5x10 ortho_5x15
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,16 @@ from qmk.math import compute
 | 
			
		||||
true_values = ['1', 'on', 'yes']
 | 
			
		||||
false_values = ['0', 'off', 'no']
 | 
			
		||||
 | 
			
		||||
# TODO: reduce this list down
 | 
			
		||||
SAFE_LAYOUT_TOKENS = {
 | 
			
		||||
    'ansi',
 | 
			
		||||
    'iso',
 | 
			
		||||
    'wkl',
 | 
			
		||||
    'tkl',
 | 
			
		||||
    'preonic',
 | 
			
		||||
    'planck',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _valid_community_layout(layout):
 | 
			
		||||
    """Validate that a declared community list exists
 | 
			
		||||
@@ -40,6 +50,7 @@ def _validate(keyboard, info_data):
 | 
			
		||||
    layouts = info_data.get('layouts', {})
 | 
			
		||||
    layout_aliases = info_data.get('layout_aliases', {})
 | 
			
		||||
    community_layouts = info_data.get('community_layouts', [])
 | 
			
		||||
    community_layouts_names = list(map(lambda layout: f'LAYOUT_{layout}', community_layouts))
 | 
			
		||||
 | 
			
		||||
    # Make sure we have at least one layout
 | 
			
		||||
    if len(layouts) == 0:
 | 
			
		||||
@@ -49,9 +60,10 @@ def _validate(keyboard, info_data):
 | 
			
		||||
    if len(layouts) == 1 and 'LAYOUT_all' in layouts:
 | 
			
		||||
        _log_warning(info_data, '"LAYOUT_all" should be "LAYOUT" unless additional layouts are provided.')
 | 
			
		||||
 | 
			
		||||
    # Extended layout name checks
 | 
			
		||||
    name_fragments = keyboard.split('/')
 | 
			
		||||
    for layout in layouts.keys():
 | 
			
		||||
    # Extended layout name checks - ignoring community_layouts and "safe" values
 | 
			
		||||
    name_fragments = set(keyboard.split('/')) - SAFE_LAYOUT_TOKENS
 | 
			
		||||
    potential_layouts = set(layouts.keys()) - set(community_layouts_names)
 | 
			
		||||
    for layout in potential_layouts:
 | 
			
		||||
        if any(fragment in layout for fragment in name_fragments):
 | 
			
		||||
            _log_warning(info_data, f'Layout "{layout}" should not contain name of keyboard.')
 | 
			
		||||
 | 
			
		||||
@@ -63,8 +75,7 @@ def _validate(keyboard, info_data):
 | 
			
		||||
            _log_error(info_data, 'Claims to support a community layout that does not exist: %s' % (layout))
 | 
			
		||||
 | 
			
		||||
    # Make sure we supply layout macros for the community layouts we claim to support
 | 
			
		||||
    for layout in community_layouts:
 | 
			
		||||
        layout_name = 'LAYOUT_' + layout
 | 
			
		||||
    for layout_name in community_layouts_names:
 | 
			
		||||
        if layout_name not in layouts and layout_name not in layout_aliases:
 | 
			
		||||
            _log_error(info_data, 'Claims to support community layout %s but no %s() macro found' % (layout, layout_name))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user