import os
from patman import command
-from patman import gitutil
-def FindGetMaintainer():
+def FindGetMaintainer(try_list):
"""Look for the get_maintainer.pl script.
+ Args:
+ try_list: List of directories to try for the get_maintainer.pl script
+
Returns:
If the script is found we'll return a path to it; else None.
"""
- try_list = [
- os.path.join(gitutil.GetTopLevel(), 'scripts'),
- ]
# Look in the list
for path in try_list:
fname = os.path.join(path, 'get_maintainer.pl')
return None
-def GetMaintainer(fname, verbose=False):
+def GetMaintainer(dir_list, fname, verbose=False):
"""Run get_maintainer.pl on a file if we find it.
We look for get_maintainer.pl in the 'scripts' directory at the top of
then we fail silently.
Args:
+ dir_list: List of directories to try for the get_maintainer.pl script
fname: Path to the patch file to run get_maintainer.pl on.
Returns:
A list of email addresses to CC to.
"""
- get_maintainer = FindGetMaintainer()
+ get_maintainer = FindGetMaintainer(dir_list)
if not get_maintainer:
if verbose:
print("WARNING: Couldn't find get_maintainer.pl")
if type(add_maintainers) == type(cc):
cc += add_maintainers
elif add_maintainers:
- cc += get_maintainer.GetMaintainer(commit.patch)
+ dir_list = [os.path.join(gitutil.GetTopLevel(), 'scripts')]
+ cc += get_maintainer.GetMaintainer(dir_list, commit.patch)
for x in set(cc) & set(settings.bounces):
print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
cc = set(cc) - set(settings.bounces)