scripts: get_maintainer: Fix glob pattern directory match error logic

The `get_maintainer` script currently generates an error when a non-
slash-suffixed glob pattern matches any directories -- this is
incorrect because the glob pattern may be used to match files.

This commit updates the script to only generate an error when a
non-slash suffixed _only_ matches directories.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
Stephanos Ioannidis 2023-04-25 23:37:18 +09:00 committed by Stephanos Ioannidis
commit 428f4a6466

View file

@ -524,10 +524,9 @@ def _check_maintainers(maints_path, yaml):
"match any files".format(glob_pattern, files_key,
area_name))
if not glob_pattern.endswith("/"):
for path in paths:
if path.is_dir():
ferr("glob pattern '{}' in '{}' in area '{}' "
"matches a directory, but has no "
if all(path.is_dir() for path in paths):
ferr("glob pattern '{}' in '{}' in area '{}' "
"matches only directories, but has no "
"trailing '/'"
.format(glob_pattern, files_key,
area_name))