aboutsummaryrefslogtreecommitdiff
path: root/tools/qconfig.py
diff options
context:
space:
mode:
authorSimon Glass2024-07-17 16:57:04 +0100
committerSimon Glass2024-07-26 08:01:06 -0600
commit630a9c9a4736fac39c858eb9bd220dd24b5e9bda (patch)
tree1f3abd25e61d7cb4ab2543e1895be9aa41b0f6dd /tools/qconfig.py
parentcc628f582aaac309e27a67d945cfeff687d2d05e (diff)
qconfig: Add a return value to do_find_config()
Return an exit code so we can use this function like do_tests(). Refactor the caller to handle this. Reduce the size of main() by putting this code into its own function. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/qconfig.py')
-rwxr-xr-xtools/qconfig.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/qconfig.py b/tools/qconfig.py
index 8cba6896667..b1487928613 100755
--- a/tools/qconfig.py
+++ b/tools/qconfig.py
@@ -1072,11 +1072,14 @@ def defconfig_matches(configs, re_match):
def do_find_config(config_list):
"""Find boards with a given combination of CONFIGs
- Params:
- config_list: List of CONFIG options to check (each a regex consisting
- of a config option, with or without a CONFIG_ prefix. If an option
- is preceded by a tilde (~) then it must be false, otherwise it must
- be true)
+ Args:
+ config_list (list of str): List of CONFIG options to check (each a regex
+ consisting of a config option, with or without a CONFIG_ prefix. If
+ an option is preceded by a tilde (~) then it must be false,
+ otherwise it must be true)
+
+ Returns:
+ int: exit code (0 for success)
"""
_, all_defconfigs, config_db, _ = read_database()
@@ -1104,6 +1107,7 @@ def do_find_config(config_list):
out.add(defc)
print(f'{len(out)} matches')
print(' '.join(item.split('_defconfig')[0] for item in out))
+ return 0
def prefix_config(cfg):
@@ -1584,8 +1588,7 @@ def main():
sys.exit(1)
return 0
if args.find:
- do_find_config(args.configs)
- return 0
+ return do_find_config(args.configs)
# We are either building the database or forcing a sync of defconfigs
config_db = {}