scripts: get_maintainer: __init__ to use filename if passed

This changes the logic in __init__() so that if a path to
MAINTAINERS.yml is passed in, it uses the passed-in value
instead of blindly running git to find the top level of
Zephyr tree.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2023-12-04 14:23:22 -08:00 committed by Fabio Baltieri
parent d3cce8805c
commit f779385b59

View file

@ -175,12 +175,12 @@ class Maintainers:
the top-level directory of the Git repository is used, and must
exist.
"""
self._toplevel = pathlib.Path(_git("rev-parse", "--show-toplevel"))
if filename is None:
self.filename = self._toplevel / "MAINTAINERS.yml"
else:
if (filename is not None) and (pathlib.Path(filename).exists()):
self.filename = pathlib.Path(filename)
self._toplevel = self.filename.parent
else:
self._toplevel = pathlib.Path(_git("rev-parse", "--show-toplevel"))
self.filename = self._toplevel / "MAINTAINERS.yml"
self.areas = {}
for area_name, area_dict in _load_maintainers(self.filename).items():