Lines Matching +full:if +full:- +full:no +full:- +full:files +full:- +full:found

4 # SPDX-License-Identifier: Apache-2.0
7 Lists maintainers for files or commits. Similar in function to
16 ./get_maintainer.py path --help
36 # Use the speedier C LibYAML parser if available
60 "-m", "--maintainers",
62 help="Maintainers file to load. If not specified, MAINTAINERS.yml in "
63 "the top-level repository directory is used, and must exist. "
65 "to the top-level directory.")
68 help="Available commands (each has a separate --help text)")
92 help="List files in areas")
97 help="Name of area to list files in. If not specified, all "
98 "non-orphaned files are listed (all files that do not appear in "
115 help="List orphaned files (files that do not appear in any area)")
120 help="Limit to files under PATH")
127 "-a",
128 "--count-areas",
132 "-c",
133 "--count-collaborators",
137 "-n",
138 "--count-maintainers",
142 "-o",
143 "--count-unmaintained",
149 if not hasattr(args, "cmd_fn"):
174 Path to the maintainers file to parse. If None, MAINTAINERS.yml in
175 the top-level directory of the Git repository is used, and must
178 if (filename is not None) and (pathlib.Path(filename).exists()):
182 self._toplevel = pathlib.Path(_git("rev-parse", "--show-toplevel"))
198 # area._match_fn(path) tests if the path matches files and/or
199 # files-regex
201 _get_match_fn(area_dict.get("files"),
202 area_dict.get("files-regex"))
204 # Like area._match_fn(path), but for files-exclude and
205 # files-regex-exclude
207 _get_match_fn(area_dict.get("files-exclude"),
208 area_dict.get("files-regex-exclude"))
228 if is_dir:
232 if area._contains(path)]
236 Returns a set() of Area instances for the areas that contain files that
241 # Final '--' is to make sure 'commits' is interpreted as a commit range
243 for path in _git("diff", "--name-only", commits, "--").splitlines():
251 # Command-line subcommands
258 if not os.path.exists(path):
259 _serr("'{}': no such file or directory".format(path))
266 if not areas:
270 if orphaned:
271 if res:
285 if args.maintainer:
286 if args.maintainer in area.maintainers:
294if not (args.count_areas or args.count_collaborators or args.count_maintainers or args.count_unmai…
295 # if no specific count is provided, print them all
306 if area.status == 'maintained':
312 if args.count_areas:
314 if args.count_maintainers:
316 if args.count_collaborators:
318 if args.count_unmaintained:
324 if args.area is None:
325 # List all files that appear in some area
328 if area._contains(path):
332 # List all files that appear in the given area
334 if area is None:
335 _serr("'{}': no such area defined in '{}'"
339 if area._contains(path):
345 if args.path is not None and not os.path.exists(args.path):
346 _serr("'{}': no such file or directory".format(args.path))
350 if area._contains(path):
353 print(path) # We get here if we never hit the 'break'
363 The status of the area, as a string. None if the area has no 'status'
367 List of maintainers. Empty if the area has no 'maintainers' key.
370 List of collaborators. Empty if the area has no 'collaborators' key.
373 List of people to inform on pull requests. Empty if the area has no
377 List of GitHub labels for the area. Empty if the area has no 'labels'
381 Text from 'description' key, or None if the area has no 'description'
385 # Returns True if the area contains 'path', and False otherwise
397 if not first:
426 # Returns None if there are neither globs nor regexes, which should be
427 # interpreted as no match.
429 if not (globs or regexes):
434 if globs:
441 if not glob.endswith("/"):
448 # return search(). (?:) is a non-capturing group.
451 if regexes:
452 if regex:
464 with open(path, encoding="utf-8") as f:
483 if not isinstance(yaml, dict):
486 ok_keys = {"status", "maintainers", "collaborators", "inform", "files",
487 "files-exclude", "files-regex", "files-regex-exclude",
494 if not isinstance(area_dict, dict):
499 if key not in ok_keys:
503 if "status" in area_dict and \
508 if not area_dict.keys() & {"files", "files-regex"}:
509 ferr("either 'files' or 'files-regex' (or both) must be specified "
512 if not area_dict.get("maintainers") and area_dict.get("status") == "maintained":
513 ferr("maintained area '{}' with no maintainers".format(area_name))
515 for list_name in "maintainers", "collaborators", "inform", "files", \
516 "files-regex", "labels", "tags", "tests":
517 if list_name in area_dict:
519 if not (isinstance(lst, list) and
521 ferr("malformed '{}' value for area '{}' -- should "
524 for files_key in "files", "files-exclude":
525 if files_key in area_dict:
527 # This could be changed if it turns out to be too slow,
528 # e.g. to only check non-globbing filenames. The tuple() is
531 if not paths:
533 "match any files".format(glob_pattern, files_key,
535 if not glob_pattern.endswith("/"):
536 if all(path.is_dir() for path in paths):
538 "matches only directories, but has no "
543 for files_regex_key in "files-regex", "files-regex-exclude":
544 if files_regex_key in area_dict:
553 if "description" in area_dict and \
555 ferr("malformed 'description' value for area '{}' -- should be a "
571 _giterr("git executable not found (when running '{}'). Check that "
578 if git_process.returncode:
580 git_cmd_s, stdout.decode("utf-8"), stderr.decode("utf-8")))
582 return stdout.decode("utf-8").rstrip()
586 cmd = ["ls-files"]
587 if path is not None:
607 "Exception raised for MAINTAINERS.yml-related errors"
611 "Exception raised for Git-related errors"
614 if __name__ == "__main__":