From 3222b5c720b1566f3711793a879b981e128692d0 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 24 Nov 2021 12:52:34 +0800 Subject: [PATCH] fix(find_apps): won't check supported targets if "recursive" is unflagged --- tools/find_apps.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/find_apps.py b/tools/find_apps.py index d97c93c5d6..0c25f4cdf1 100755 --- a/tools/find_apps.py +++ b/tools/find_apps.py @@ -134,16 +134,7 @@ def find_apps(build_system_class, path, recursive, exclude_list, target): """ build_system_name = build_system_class.NAME logging.debug('Looking for {} apps in {}{}'.format(build_system_name, path, ' recursively' if recursive else '')) - if not recursive: - if exclude_list: - logging.warning('--exclude option is ignored when used without --recursive') - if not build_system_class.is_app(path): - logging.warning('Path {} specified without --recursive flag, but no {} app found there'.format( - path, build_system_name)) - return [] - return [path] - # The remaining part is for recursive == True apps_found = [] # type: typing.List[str] for root, dirs, _ in os.walk(path, topdown=True): logging.debug('Entering {}'.format(root)) @@ -167,6 +158,12 @@ def find_apps(build_system_class, path, recursive, exclude_list, target): logging.debug('Skipping, app has no supported targets') continue + if not recursive: + if not apps_found: + logging.warning('Path {} specified without --recursive flag, but no {} app found there'.format( + path, build_system_name)) + break # only check the top-most dir if "recursive" is unflagged + return apps_found