summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2023-01-18 22:37:06 +0000
committerQMK Bot <hello@qmk.fm>2023-01-18 22:37:06 +0000
commit364a910b92380559a9202f11bbf5f760d4534979 (patch)
tree42f9b92e6c9e60a0ec0c195f764c6e34708459f7 /lib/python/qmk/cli
parent82a94ea1bd4d930aebb15f7a3316836a0488421d (diff)
parent17c9388af5432f8e6d97828f6772eaf8031a786b (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-xlib/python/qmk/cli/mass_compile.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/mass_compile.py b/lib/python/qmk/cli/mass_compile.py
index b5f12c5026..a98f7ad482 100755
--- a/lib/python/qmk/cli/mass_compile.py
+++ b/lib/python/qmk/cli/mass_compile.py
@@ -2,6 +2,7 @@
2 2
3This will compile everything in parallel, for testing purposes. 3This will compile everything in parallel, for testing purposes.
4""" 4"""
5import fnmatch
5import logging 6import logging
6import multiprocessing 7import multiprocessing
7import os 8import os
@@ -58,7 +59,8 @@ def _load_keymap_info(keyboard, keymap):
58 arg_only=True, 59 arg_only=True,
59 action='append', 60 action='append',
60 default=[], 61 default=[],
61 help="Filter the list of keyboards based on the supplied value in rules.mk. Matches info.json structure, and accepts the format 'features.rgblight=true'. May be passed multiple times, all filters need to match." 62 help= # noqa: `format-python` and `pytest` don't agree here.
63 "Filter the list of keyboards based on the supplied value in rules.mk. Matches info.json structure, and accepts the format 'features.rgblight=true'. May be passed multiple times, all filters need to match. Value may include wildcards such as '*' and '?'." # noqa: `format-python` and `pytest` don't agree here.
62) 64)
63@cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.") 65@cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.")
64@cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.") 66@cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.")
@@ -102,11 +104,13 @@ def mass_compile(cli):
102 cli.log.info(f'Filtering on condition ("{key}" == "{value}")...') 104 cli.log.info(f'Filtering on condition ("{key}" == "{value}")...')
103 105
104 def _make_filter(k, v): 106 def _make_filter(k, v):
107 expr = fnmatch.translate(v)
108 rule = re.compile(expr, re.IGNORECASE)
109
105 def f(e): 110 def f(e):
106 lhs = e[2].get(k) 111 lhs = e[2].get(k)
107 lhs = str(False if lhs is None else lhs).lower() 112 lhs = str(False if lhs is None else lhs)
108 rhs = str(v).lower() 113 return rule.search(lhs) is not None
109 return lhs == rhs
110 114
111 return f 115 return f
112 116