summaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/qmk/cli/lint.py2
-rw-r--r--lib/python/qmk/keymap.py11
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/lint.py b/lib/python/qmk/cli/lint.py
index bcf905f579..bc14b61e8b 100644
--- a/lib/python/qmk/cli/lint.py
+++ b/lib/python/qmk/cli/lint.py
@@ -26,7 +26,7 @@ def _list_defaultish_keymaps(kb):
26 defaultish.extend(INVALID_KM_NAMES) 26 defaultish.extend(INVALID_KM_NAMES)
27 27
28 keymaps = set() 28 keymaps = set()
29 for x in list_keymaps(kb): 29 for x in list_keymaps(kb, include_userspace=False):
30 if x in defaultish or x.startswith('default'): 30 if x in defaultish or x.startswith('default'):
31 keymaps.add(x) 31 keymaps.add(x)
32 32
diff --git a/lib/python/qmk/keymap.py b/lib/python/qmk/keymap.py
index 8e36461722..b7138aa4a1 100644
--- a/lib/python/qmk/keymap.py
+++ b/lib/python/qmk/keymap.py
@@ -399,7 +399,7 @@ def is_keymap_target(keyboard, keymap):
399 return False 399 return False
400 400
401 401
402def list_keymaps(keyboard, c=True, json=True, additional_files=None, fullpath=False): 402def list_keymaps(keyboard, c=True, json=True, additional_files=None, fullpath=False, include_userspace=True):
403 """List the available keymaps for a keyboard. 403 """List the available keymaps for a keyboard.
404 404
405 Args: 405 Args:
@@ -418,14 +418,19 @@ def list_keymaps(keyboard, c=True, json=True, additional_files=None, fullpath=Fa
418 fullpath 418 fullpath
419 When set to True the full path of the keymap relative to the `qmk_firmware` root will be provided. 419 When set to True the full path of the keymap relative to the `qmk_firmware` root will be provided.
420 420
421 include_userspace
422 When set to True, also search userspace for available keymaps
423
421 Returns: 424 Returns:
422 a sorted list of valid keymap names. 425 a sorted list of valid keymap names.
423 """ 426 """
424 names = set() 427 names = set()
425 428
429 has_userspace = HAS_QMK_USERSPACE and include_userspace
430
426 # walk up the directory tree until keyboards_dir 431 # walk up the directory tree until keyboards_dir
427 # and collect all directories' name with keymap.c file in it 432 # and collect all directories' name with keymap.c file in it
428 for search_dir in [QMK_FIRMWARE, QMK_USERSPACE] if HAS_QMK_USERSPACE else [QMK_FIRMWARE]: 433 for search_dir in [QMK_FIRMWARE, QMK_USERSPACE] if has_userspace else [QMK_FIRMWARE]:
429 keyboards_dir = search_dir / Path('keyboards') 434 keyboards_dir = search_dir / Path('keyboards')
430 kb_path = keyboards_dir / keyboard 435 kb_path = keyboards_dir / keyboard
431 436
@@ -443,7 +448,7 @@ def list_keymaps(keyboard, c=True, json=True, additional_files=None, fullpath=Fa
443 info = info_json(keyboard) 448 info = info_json(keyboard)
444 449
445 community_parents = list(Path('layouts').glob('*/')) 450 community_parents = list(Path('layouts').glob('*/'))
446 if HAS_QMK_USERSPACE and (Path(QMK_USERSPACE) / "layouts").exists(): 451 if has_userspace and (Path(QMK_USERSPACE) / "layouts").exists():
447 community_parents.append(Path(QMK_USERSPACE) / "layouts") 452 community_parents.append(Path(QMK_USERSPACE) / "layouts")
448 453
449 for community_parent in community_parents: 454 for community_parent in community_parents: