summaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-05-09 21:39:48 +0100
committerGitHub <noreply@github.com>2021-05-09 22:39:48 +0200
commit3f854e16acc880b9c9ccab2244dc585705dfac1e (patch)
tree881528153ff7aea5a0bbff39ef40278ef9103e36 /lib/python
parent4fa32f0f042eecdb662d6d56d508e03cb6ff83c9 (diff)
Catch 'LAYOUTS = all' in lint (#12848)
Co-authored-by: Zach White <skullydazed@drpepper.org>
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/qmk/info.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index e2350b7f72..47c8bff7a8 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -19,6 +19,12 @@ true_values = ['1', 'on', 'yes']
false_values = ['0', 'off', 'no']
+def _valid_community_layout(layout):
+ """Validate that a declared community list exists
+ """
+ return (Path('layouts/default') / layout).exists()
+
+
def info_json(keyboard):
"""Generate the info.json data for a specific keyboard.
"""
@@ -71,6 +77,13 @@ def info_json(keyboard):
if not info_data.get('layouts'):
_log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in the keyboard.h or info.json.')
+ # Filter out any non-existing community layouts
+ for layout in info_data.get('community_layouts', []):
+ if not _valid_community_layout(layout):
+ # Ignore layout from future checks
+ info_data['community_layouts'].remove(layout)
+ _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 info_data.get('community_layouts', []):
layout_name = 'LAYOUT_' + layout