1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2012 The Chromium OS Authors.
7 from patman import command
9 def FindGetMaintainer(try_list):
10 """Look for the get_maintainer.pl script.
13 try_list: List of directories to try for the get_maintainer.pl script
16 If the script is found we'll return a path to it; else None.
20 fname = os.path.join(path, 'get_maintainer.pl')
21 if os.path.isfile(fname):
26 def GetMaintainer(dir_list, fname, verbose=False):
27 """Run get_maintainer.pl on a file if we find it.
29 We look for get_maintainer.pl in the 'scripts' directory at the top of
30 git. If we find it we'll run it. If we don't find get_maintainer.pl
31 then we fail silently.
34 dir_list: List of directories to try for the get_maintainer.pl script
35 fname: Path to the patch file to run get_maintainer.pl on.
38 A list of email addresses to CC to.
40 get_maintainer = FindGetMaintainer(dir_list)
41 if not get_maintainer:
43 print("WARNING: Couldn't find get_maintainer.pl")
46 stdout = command.Output(get_maintainer, '--norolestats', fname)
47 lines = stdout.splitlines()
48 return [ x.replace('"', '') for x in lines ]